Live data from Hacker News

A Dead-Simple Web Stack in Haskell

williamyaoh.com

51–60 of 120 posts

Re: A Dead-Simple Web Stack in Haskell

#51

Earlier quoted context omitted.

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'…

> It's a qualitative statement and disingenuous. Complex relative to what? Complex relative to most programming languages. C++ is more complex. That says very little. C++ is an extreme outlier. I think Haskellers do a disservice to people they're trying to convince to do haskell by saying it's not complex. Haskell has a zillion extensions and crazy features, most of which show up in at least some popular Hackage libr…

You are still wrong, dispite your disclaimers. Haskell has a tiny core language, which neatly breaks apart complexity. Most mainstream languages don't, which makes them far harder to thoroughly understand. there's no way easy to know what complexity is essential, and what can be reduced away. Abstractions are rather informal, and likely to leak.

Re: A Dead-Simple Web Stack in Haskell

#52

Earlier quoted context omitted.

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 deployme…

I could also edit live on my production server and the result would be the same: a website. I'm not saying that modern stacks aren't more complicated than they need, but I use a React frontend, a React-Native app, silly microservices, a non-trivial git strategy, non-trivial Trello steps, security scans, automated deployment via CircleCI and yet release multiple times a day. The biggest difference is that deployment a…

Anyone can put a complicated CI/CD pipeline on top of any language, including PHP. What does this have to do with the amount of hoops certain languages force their users to jump through just to see some dynamic content?

Re: A Dead-Simple Web Stack in Haskell

#53

Earlier quoted context omitted.

> It's a qualitative statement and disingenuous. Complex relative to what? Complex relative to most programming languages. C++ is more complex. That says very little. C++ is an extreme outlier. I think Haskellers do a disservice to people they're trying to convince to do haskell by saying it's not complex. Haskell has a zillion extensions and crazy features, most of which show up in at least some popular Hackage libr…

You are still wrong, dispite your disclaimers. Haskell has a tiny core language, which neatly breaks apart complexity. Most mainstream languages don't, which makes them far harder to thoroughly understand. there's no way easy to know what complexity is essential, and what can be reduced away. Abstractions are rather informal, and likely to leak.

Your argument is that a language with a 750,000 line implementation and a zillion features is simple because one of its IRs is simple? Doesn't seem very convincing.

Re: A Dead-Simple Web Stack in Haskell

#54

Earlier quoted context omitted.

> It's a qualitative statement and disingenuous. Complex relative to what? Complex relative to most programming languages. C++ is more complex. That says very little. C++ is an extreme outlier. I think Haskellers do a disservice to people they're trying to convince to do haskell by saying it's not complex. Haskell has a zillion extensions and crazy features, most of which show up in at least some popular Hackage libr…

Cool, I like Haskell a fair bit too. It took a long time to get here. I don't think it's the perfect language but I agree that it is probably much better than most other languages out there. I'm hoping that languages built on dependent types like Lean will eventually come to the main stream. I see your point about doing a disservice. It is a tricky thing trying to convince people to adopt a language like Haskell that…

> I think it's equally a disservice to tell people it's too complex to learn. There's a common impression people get that they have to master category theory before they can begin to understand Haskell code. That's also troubling and kind of what I was getting at with this whole thing in a round-about-way.

Ah, I see where you're coming from more now. Yes, the "category theory is recommended alongside learning haskell" meme is terrible. In that context saying Haskell is simple is an improvement. I think people can handle nuance though, and "haskell has a simple core, but in practice GHC haskell is a big language" is something they can handle.

Re: A Dead-Simple Web Stack in Haskell

#55

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…

Doing PHP programming was my first programming job, lasted for about 3 years. While I agree with you about the allure of PHP, to be honest, I will never choose PHP again or touch any projects that uses PHP. PHP is an awful, obsolete language, patched again and again to make it more modern. It's like wearing an old leather jacket that has been patched repeatedly, yet it still has a nasty smell. This is entirely subjec…

Absolutely none of that takes away from the original comment though.

PHP as a language is pretty garbage.

PHP’s deployment story and as a concept is pretty interesting, and we’ve dropped it entirely as a community. The reasons why are interesting to explore, I think.

The closest to it is something like Node, I guess: install the language, you can wire up an HTTP server with a couple functions, but it’s still lacking the simplicity of PHP there.

Python gets kind of close too, using something like Flask, but now we’ve got libraries we’re talking about.

I’d love to see a web-first language with PHP-styled ease, but with a much better language, and the ability to go down the road of Python/Flask etc. with function-based routes if one pleases.

Of course, frankly, a lot of your comments on PHP are out of date, but that’s neither here nor there: the language barely matters for what is under discussion.

Re: A Dead-Simple Web Stack in Haskell

#56

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 sounds like what Zeit.co is doing. Now.sh is nearly zero-config for a static HTML index and any number of functions in many languages under /api/ In their version 1 they actually even looked for index.js in the root and evaluated that one, but now such a thing requires config (and it isn’t even clear on how to achieve it)

I definitely hope this sort of idea takes off: it’s got a lot of promise to eventually take over from PHP for the “get a beginner rendering dynamic content to a browser quickly” use-case, which is how I learned to program 15 years ago!

Re: A Dead-Simple Web Stack in Haskell

#57

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…

While you can theoretically get to this level of simplicity with various tools I think the difference isn't so much "can it be this simple?" so much as "does this level of simplicity fit my needs?" and that can be harder to quantify.

The same thing you wrote in PHP done in Node.js in an arbitrarily named file served from root:

require('http').createServer((_, res) => res.end('Hello World')).listen(80);

Zero configuration. You could trivially add some lines from 'fs' to get it to read files instead and whenever you update those files it'll automatically serve the new ones. The problem isn't that it can't be simple. It's that the people cutting checks (or at least the people informing them) also want SSL, non-static pages, sanitized inputs, an attractive interface, log retention, data persistence, ease-of-access, etc.

If people were paying me my current rate to send their users unstyled static text over HTTP I'd gladly walk away from all the process. But if they want me to maintain my sanity while writing a non-trivial web application I think integrating a type checker pays off after the first few thousand lines of code. And if I know things are going to get there from the outset then setting it up in advance isn't exactly insanity.

Re: A Dead-Simple Web Stack in Haskell

#58

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 ?

I disagree with the others, and think this is indeed simple enough without caveats about setting it up (setting up WAMP is honestly just as much effort — not much), and what I’ve used to teach friends who wanted to learn some web programming with zero initial understanding.

Explaining routes and handlers was a bit hard, compared to files. I wonder if there’s a “file based” version for Node that’d work like and express handler for the files route?

Re: A Dead-Simple Web Stack in Haskell

#59

Earlier quoted context omitted.

You are still wrong, dispite your disclaimers. Haskell has a tiny core language, which neatly breaks apart complexity. Most mainstream languages don't, which makes them far harder to thoroughly understand. there's no way easy to know what complexity is essential, and what can be reduced away. Abstractions are rather informal, and likely to leak.

Your argument is that a language with a 750,000 line implementation and a zillion features is simple because one of its IRs is simple? Doesn't seem very convincing.

Haskell2010's definition is like 20 pages long and that includes the definition of the standard library. This core accounts for 90-99% of the code in project that isn't going out of its way to use fancy features for the lulz.

Re: A Dead-Simple Web Stack in Haskell

#60

Earlier quoted context omitted.

Your argument is that a language with a 750,000 line implementation and a zillion features is simple because one of its IRs is simple? Doesn't seem very convincing.

Haskell2010's definition is like 20 pages long and that includes the definition of the standard library. This core accounts for 90-99% of the code in project that isn't going out of its way to use fancy features for the lulz.

Name me a single company that uses Haskell 2010. It's completely irrelevant.

But I'll leave you to argue with Vitaly Bragilevsky (speaking at Galois):

"Haskell is a big language" -- https://galois.com/blog/2018/11/teaching-haskell-in-the-real...

Or Paul Hudak, Philip Wadler, and Simon Peyton Jones:

"Haskell is a big language" -- https://www.microsoft.com/en-us/research/wp-content/uploads/... (p.28)

Maybe those guys know something.

It's cool Haskell goes through a small IR. That doesn't make TH, rewrite rules, CPP, the million extensions, STG, the runtime, the gigantic syntax, or the quarter million SLOC implementation simple.

Post reply on HN