A web programmer must be fluent in at least four languages: HTML, CSS, JavaScript, and a fourth language for writing server code. There’s nothing wrong with having specialized domain-specific languages — the problem is, they don’t fit together nicely. This is why a web developer has to learn the fifth language — the language of the application he or she uses to put together a web site. There are many such applications and each comes with a large set of rules and conventions. These applications are as flexible as their designers made them. They make common patterns easy to implement, but they don’t help with general programmability. For that you need a programming language, not an environment.
The idea behind the Yesod framework is to use an existing language, Haskell, to unify all aspects of web programming. There are many reasons why a functional language is a great fit for web programming — for instance, the way it deals with state and mutation matches very well the RESTful principles of client/server interaction.
I realize that most web programmers are not familiar with Haskell, so I decided to create a series of tutorials introducing Yesod for non-Haskellers. You’ll learn Haskell as you go, in small increments. Here’s the first installment of this tutorial. Enjoy!
Follow @BartoszMilewski
October 4, 2012 at 3:45 pm
Thanks for the tutorial! I’ve attempted to try it out, and since then I have a few questions; I’ve tried googling around but haven’t run into anything substantive, perhaps I’ll have a better luck asking at the source that piqued my interest 😉
0. I’ve followed the steps @ http://www.yesodweb.com/page/quickstart — however, I’m having issues with the “Start a new site” step: the dev server @ the port 3000 just hangs there, without serving content to the browser (it’s not “connection refused” kind of error either, nor anything like it — the browser just waits there until the connection times out). I was only able to determine that it wasn’t a firewall issue, since as soon as I’ve terminated the server (pressing the Enter key in the console window) the browser immediately stops waiting and reports “connection reset by peer.” So, there’s clearly something going on, but not enough for the content to get through.
1. Is it possible to use it as an Apache module, akin to, e.g., mod_php?
2. Can you recommend some references on deployment? I only ran across some extremely terse summary here — http://www.yesodweb.com/book/deploying-your-webapp — perhaps you’d be able to recommend something better (e.g., I’ve found the paragraph “CGI on Apache” fairly useless / uninformative, compared, for instance, to the docs @ http://www.php.net/manual/en/install.php)?
October 6, 2012 at 10:28 am
@mttpd
I’m happy to hear that you started looking into getting up-and-running with Yesod. For (0), I’m not sure what the issue is. I wouldn’t actually rule out firewall entirely, as the OS might be waiting for approval for the app to send the response. For debugging that kind of issue, it would be best to follow up with the Yesod mailing list (http://groups.google.com/group/yesodweb). Please specify which OS you’re running on.
There’s no Apache-specific module. Instead, the recommendation would be to either reverse-HTTP proxy to the app or use FastCGI. The former has been benchmarked to be significantly faster.
I’m planning on writing a more in-depth guide to deploying apps on the Yesod blog itself (http://www.yesodweb.com/blog), please stay tuned over there for more information. Also, FP Complete is working on some ideas to simplify deployment of Yesod apps, so you can expect this to become easier in the future.
October 7, 2012 at 1:38 am
[…] Approach to Web Programming Haskell for web prgrammers ::: Bartosz Milewski’s Programming Cafe Luigi […]
October 7, 2012 at 2:32 am
There is actually a similar approach for Smalltalk developers, Orca: http://www.hpi.uni-potsdam.de/hirschfeld/projects/orca/index.html
October 15, 2012 at 1:39 am
Thank you! Waiting for more!