Live data from Hacker News

A Dead-Simple Web Stack in Haskell

williamyaoh.com

11–20 of 120 posts

Re: A Dead-Simple Web Stack in Haskell

#11

I think a simple web stack should aspire to the simplicity of the PHP stack, twenty years ago: 1) Create a directory "foo" on your server 2) Make a file called "bar.php" in that directory 3) Write "Hello World!" in the file 4) Open http://localhost/foo/bar.php in the browser and see "Hello World!" Lines of code or configuration so far: zero . 5) Add some actual code to bar.php 6) Reload the page and see the result Nu…

That's not actually simple, it's just convention over configuration.

It actually complicates a lot of things, like routing and templating: Those files implicitly do the routing and templating, until they don't, which is where the mess starts.

I'd much rather just write request handlers.

Re: A Dead-Simple Web Stack in Haskell

#12

I think a simple web stack should aspire to the simplicity of the PHP stack, twenty years ago: 1) Create a directory "foo" on your server 2) Make a file called "bar.php" in that directory 3) Write "Hello World!" in the file 4) Open http://localhost/foo/bar.php in the browser and see "Hello World!" Lines of code or configuration so far: zero . 5) Add some actual code to bar.php 6) Reload the page and see the result Nu…

Did you forget the “A” in LAMP? It’s hardly zero configuration.

Re: A Dead-Simple Web Stack in Haskell

#13
post #9

Earlier quoted context omitted.

> Haskell is extremely complex I extremely disagree. I think C++ is extremely complex. Haskell is simple by comparison [0]. Once you understand enough Haskell to write basic programs in it this stack is roughly similar in scope to a Ruby + Sinatra or Python + Flask web application. [0] https://www.youtube.com/watch?v=PNRju6_yn3o

It depends on what we mean by Haskell. If we mean "Haskell the latest specification" that's Haskell 2010. I suppose we could think of it as pretty simple, though lazy evaluation means that any implementation of it is going to be complicated. However I don't know of a single company that uses plain Haskell 2010. They all use GHC (or more complex tools like GHCJS!) and GHC Haskell is a beast: https://downloads.haskell.…

And how many companies use a C++ standard? GCC and Clang both provide a large number of extensions.

https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/C-Extensions.ht... https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/C_002b_002b-Ext...

Re: A Dead-Simple Web Stack in Haskell

#14
post #9

Earlier quoted context omitted.

> Haskell is extremely complex I extremely disagree. I think C++ is extremely complex. Haskell is simple by comparison [0]. Once you understand enough Haskell to write basic programs in it this stack is roughly similar in scope to a Ruby + Sinatra or Python + Flask web application. [0] https://www.youtube.com/watch?v=PNRju6_yn3o

It depends on what we mean by Haskell. If we mean "Haskell the latest specification" that's Haskell 2010. I suppose we could think of it as pretty simple, though lazy evaluation means that any implementation of it is going to be complicated. However I don't know of a single company that uses plain Haskell 2010. They all use GHC (or more complex tools like GHCJS!) and GHC Haskell is a beast: https://downloads.haskell.…

Fair enough there are some combinations of compiler extensions that don't interact well and I've written enough type level code to know which ones to stay away from.

The C++ move semantics are standard though and have lots of unintended consequences to make easy-to-describe constructors incredibly difficult to implement in practice.

My point was that saying Haskell is extremely complex is not technically correct. It's a qualitative statement and disingenuous. Complex relative to what? The stack the OP is presenting is relatively simple in the Haskell space. It's not inherently complex by virtue of being written in Haskell.

Re: A Dead-Simple Web Stack in Haskell

#15
post #9

Earlier quoted context omitted.

> Haskell is extremely complex I extremely disagree. I think C++ is extremely complex. Haskell is simple by comparison [0]. Once you understand enough Haskell to write basic programs in it this stack is roughly similar in scope to a Ruby + Sinatra or Python + Flask web application. [0] https://www.youtube.com/watch?v=PNRju6_yn3o

It depends on what we mean by Haskell. If we mean "Haskell the latest specification" that's Haskell 2010. I suppose we could think of it as pretty simple, though lazy evaluation means that any implementation of it is going to be complicated. However I don't know of a single company that uses plain Haskell 2010. They all use GHC (or more complex tools like GHCJS!) and GHC Haskell is a beast: https://downloads.haskell.…

First, that was a nice article.

Second, I agree with you that Haskell does not have to be too complicated. I only ever use a few language extensions, I use a subset of the language, and try to do repl oriented development.

The downside of my simple approach is that reading other people’s code takes real effort because I am likely to not understand many of the idioms and techniques that other people use.

Programming should be fun and productive, and it is up to everyone to figure out what works for them.

Re: A Dead-Simple Web Stack in Haskell

#16

I think a simple web stack should aspire to the simplicity of the PHP stack, twenty years ago: 1) Create a directory "foo" on your server 2) Make a file called "bar.php" in that directory 3) Write "Hello World!" in the file 4) Open http://localhost/foo/bar.php in the browser and see "Hello World!" Lines of code or configuration so far: zero . 5) Add some actual code to bar.php 6) Reload the page and see the result Nu…

Did you forget the “A” in LAMP? It’s hardly zero configuration.

Anybody could make any language in any app deployed to anything as simple as `sh scripts/build.sh && teraform apply` in my eyes.

Re: A Dead-Simple Web Stack in Haskell

#17

I think a simple web stack should aspire to the simplicity of the PHP stack, twenty years ago: 1) Create a directory "foo" on your server 2) Make a file called "bar.php" in that directory 3) Write "Hello World!" in the file 4) Open http://localhost/foo/bar.php in the browser and see "Hello World!" Lines of code or configuration so far: zero . 5) Add some actual code to bar.php 6) Reload the page and see the result Nu…

1) Install node js 2) npm install express 4) Define handler

Seems simple enough ?

Re: A Dead-Simple Web Stack in Haskell

#18

I think a simple web stack should aspire to the simplicity of the PHP stack, twenty years ago: 1) Create a directory "foo" on your server 2) Make a file called "bar.php" in that directory 3) Write "Hello World!" in the file 4) Open http://localhost/foo/bar.php in the browser and see "Hello World!" Lines of code or configuration so far: zero . 5) Add some actual code to bar.php 6) Reload the page and see the result Nu…

I agree that software development has become (often) pointlessly over complicated in the past few years.

For my personal projects I usually develop in Yii2, vanilla JS, SCSS, on MAMP. Source lives in Git, deploy via FTP. I track my progress on a simple kanban. I can push out really complex web applications in days.

At work, currently we use headless Drupal 8 as an API layer, React/Angular frontend, automated deployments via Jenkins (that takes over 30 minutes), silly microservices, an over complicated Git strategy, with over complicated Jira/Confluence steps, security scans, pen testing. It takes months to release anything.

They're two different approaches, one is quick and "dirty", the other is "enterprise", but the end result is the same: a website.

The biggest difference is the amount of time and the cost.

Re: A Dead-Simple Web Stack in Haskell

#19
I love this.

I'm a Haskell newbie, I only do Haskell in my spare time, only sometimes, so I don't have time to hunt around for recipes. Kudos to the author, I'll surely borrow from this.

---

I also built a simple web server in Haskell for triggering commands via GitHub's Webhooks [1].

So if you're interested in a very simple, yet useful web app to analyze, see:

https://github.com/alexandru/github-webhook-listener

My use-case is to serve a static website using my own VPS, but have Travis build the website (via a static generator) for me. After Travis builds the website via Jekyll, it pushes it to the gh-pages branch, then GitHub pings my server via the installed webhook, which triggers a refresh with the latest build.

[1] https://developer.github.com/webhooks/

Re: A Dead-Simple Web Stack in Haskell

#20

I think a simple web stack should aspire to the simplicity of the PHP stack, twenty years ago: 1) Create a directory "foo" on your server 2) Make a file called "bar.php" in that directory 3) Write "Hello World!" in the file 4) Open http://localhost/foo/bar.php in the browser and see "Hello World!" Lines of code or configuration so far: zero . 5) Add some actual code to bar.php 6) Reload the page and see the result Nu…

1) Install node js 2) npm install express 4) Define handler Seems simple enough ?

[deleted]
Post reply on HN