Live data from Hacker News

A Dead-Simple Web Stack in Haskell

williamyaoh.com

31–40 of 120 posts

Re: A Dead-Simple Web Stack in Haskell

#31

Earlier quoted context omitted.

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…

Yup. I think people forget that things aren't the way they used to be because we made forward progress. Maybe that means things got more complex. It also means more things became possible and it became possible to not have things happen which you wish didn't. If everything worked so fine and dandy in the good old days, we'd still be there.

> If everything worked so fine and dandy in the good old days, we'd still be there.

I'm not a historian, but I'm pretty sure a historian could find a lot of counter examples to statements like this.

That includes historians who know an aweful lot about programming languages.

Re: A Dead-Simple Web Stack in Haskell

#32

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

I entirely agree about the language itself being a comfortable middle weight, somewhere around the order of Python. But both languages give you a lot of scope to make things complicated and there are much stronger norms against making code as clever as possible in Python than in Haskell. Is there a Pythonic Haskell movement? Because if there isn't there should be.

There is this great talk 'stick to simple Haskell' along those lines, but unfortunately it is hosted here https://skillsmatter.com/skillscasts/14133-stick-to-simple-h...

Unfortunately I can't find it anywhere else, but it is worth keeping your ears out in case it pops up somewhere..

Re: A Dead-Simple Web Stack in Haskell

#33

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…

>I can start as fast with my favorite technologies and without hitting a wall later.

What are your "favorite technologies"? Where can I get a hosting using your "favorite technologies" that would allow me to create dynamic server-size content just by editing a single file? (No command line fuckage.) Will the resulting solution be portable to other hosting providers?

Re: A Dead-Simple Web Stack in Haskell

#34

Earlier quoted context omitted.

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…

Yup. I think people forget that things aren't the way they used to be because we made forward progress. Maybe that means things got more complex. It also means more things became possible and it became possible to not have things happen which you wish didn't. If everything worked so fine and dandy in the good old days, we'd still be there.

So much agree. The web is very large and there are tons of use cases. So when people start talking about it being so difficult to setup a website because of all these things I just can't understand where there head is at.

It's like complaining that they built a rocket destined to go the moon, handled all the requirements to do that, but their use case would have been handled by a weather balloon. Of course they are going to complain about it being overly complex, because it was for their use case.

Things aren't helped by companies have dev relations pushing out articles about using their complex stack with simple examples (to get you interested in it for work), or people writing their own blog posts to get familiar with some new/complex stack, and devs reading these thinking they must be using them. Analyze what is being used and why, then decide to use it.

Re: A Dead-Simple Web Stack in Haskell

#35

Earlier quoted context omitted.

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…

Yup. I think people forget that things aren't the way they used to be because we made forward progress. Maybe that means things got more complex. It also means more things became possible and it became possible to not have things happen which you wish didn't. If everything worked so fine and dandy in the good old days, we'd still be there.

I can respect this, and acknowledge that there are use cases for all the infrastructure. My question is, are the trade-offs being considered? Not every use case requires all the bells and whistles. It seems possible that development pipelines have moved towards using the bells and whistles in part because developers are familiar with them from FAANG use cases. People choose to use what is in use, often for good reason like there being greater documentation and support for a tool in heavy active use. But that doesn't necessarily mean you're using the right tool for the job. It involves weighing the reduced development costs with possible increases in deployment issues. There are a lot of companies with delusions of grandeur, trying to future proof for massive scaling issues that most likely will never come.

Re: A Dead-Simple Web Stack in Haskell

#36

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 assumes you've got apache set up, or nginx and php-fpm. It also uses the php interpretor. If you had to build a binary like Haskell would, your approach would be different (although you could run haskell in interpreted mode I wouldn't recommend it). It's also kind of unfair because PHP was created for making web pages, Haskell wasn't.

Re: A Dead-Simple Web Stack in Haskell

#37

Haskell is extremely complex, and that’s the point: to isolate complexity at the language level, where safe patterns can be researched, developed, and then scaled out to arbitrary applications. Please call this “Towards a simple Haskell web stack” or something else less oxymoronic.

Haskell 2010 isn't that complex. It's sum and product types and typeclasses, essentially.

The many language extensions, depending on what you use, can make for something extremely complex, but you also don't have to do much more than enable them in many situations if you're just a user of a library.

Re: A Dead-Simple Web Stack in Haskell

#38

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…

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 is so different from everything else they've likely used. If you say it's easy they're probably going to stop inviting you to dinner.

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.

Take a post about a dead simple Ruby + Sinatra application. You'd still expect a developer to learn classes, messages, methods, types, modules and probably rake or foreman or something. It's pretty complicated but not insurmountable.

TFA uses one language extension. The libraries are roughly similar in size to the APIs exposed by Sinatra. Many of the concepts port over. But because it's written in Haskell it's somehow too complex and can't be simple?

I make no bones about Haskell being difficult to learn. However I don't think that makes it a complex language. In C++ I have to learn about constructors, intialization lists, and all of the ways that move semantics make it extremely complicated to make the language do what I want.

Haskell may be hard to learn but once you get over the initial hump it scales well and is rather simple in many ways.

Re: A Dead-Simple Web Stack in Haskell

#39

Earlier quoted context omitted.

Yup. I think people forget that things aren't the way they used to be because we made forward progress. Maybe that means things got more complex. It also means more things became possible and it became possible to not have things happen which you wish didn't. If everything worked so fine and dandy in the good old days, we'd still be there.

> If everything worked so fine and dandy in the good old days, we'd still be there. I'm not a historian, but I'm pretty sure a historian could find a lot of counter examples to statements like this. That includes historians who know an aweful lot about programming languages.

Oh yeah. Take consumer goods got example: A straight razor or double edge safety razor and a bar of soap work an awful lot better, cost the customer significantly less, and produce far less waste than modern mass-produced shaving convenience goods at the expense of greater initial costs and a modest increase in required skillset.

A fountain pen with a hand-tuned gold nib is refillable and can last nearly a lifetime with proper use. It also requires good writing technique which will reduce fatigue and enhance legibility.

I've yet to find a modern can opener that is remotely usable with any kind of longevity. Instead I keep a couple of swiss army knives in my drawer that always just work, and are faster and are easier to clean than any modern can opener I've tried.

Hand-made leather boots can be resoled several times and last a decade or more.

All of these things have the same common themes: They were hard to mass-manufacture or sell in quantities as large as mass-manufactured goods, they require a bit more upfront costs to use, and require a modest skill investment by the consumer so there's a barrier to entry.

That last bit though is the sinister one though. Moving to more forgiving implements is better right? Not if it means you never learn proper technique for doing things. Dig through a manual on penmanship from the late 1800's and you'll find a wealth of valuable knowledge that can help you write neater and with almost no fatigue even with a modern ball-point pen. Curiously, we don't get lessons even close to that in school today.

How's this relevant? Take these attitudes and apply them to software development. If you make your tools more forgiving, you can get away with less training for your developers, right?! Less upfront investment in hiring competent developers! Emphasize scale and throughput over quality! ...and all of a sudden, you NEED a bunch of tools to make up for the increase in project complexity of band-aids slapped on top of poor design. And hey, if you slow development to a crawl, you dramatically reduce the frequency of major errors/downtime! Win-win! /s

Re: A Dead-Simple Web Stack in Haskell

#40
post #36

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 assumes you've got apache set up, or nginx and php-fpm. It also uses the php interpretor. If you had to build a binary like Haskell would, your approach would be different (although you could run haskell in interpreted mode I wouldn't recommend it). It's also kind of unfair because PHP was created for making web pages, Haskell wasn't.

If the lesson is "use languages specifically designed for the use case", then that's a lesson worth learning.
Post reply on HN