School of Haskell Goes Beta

31 Jan 2013 Bartosz Milewski

We are happy to announce the beta of the FP Complete School of Haskell. Our goal is to remove the biggest obstacle to learning the language.

All you procrastinators promising yourselves to take up Haskell one day -- you have no excuses left! Go to our beta signup page and get a chance to experience Haskell the way it was intended to be. You can also watch a video walk-through of the School of Haskell on that page.

What is School of Haskell?

School of Haskell is mainly about learning Haskell. In this world of instant gratification, to ask a potential student to find a book (even if it's an online book), install the compiler, fiddle with the editor, go through the edit/save/load/compile/fix-errors/eventually-run cycle is just too much to ask. This is the 21st century! Granted, we are still far away from The Diamond Age, and the School of Haskell is not "A Young Lady's Illustrated Primer," but we are getting there.

The first thing you notice when you browse through the School of Haskell is a number of tutorials, some of them bundled into courses. At this moment the list is very incomplete, but it's enough to get you started. More content will be appearing on a regular basis.

When you open a tutorial, it looks pretty much like a programmer's blog -- until you notice that some of the embedded code fragments are alive. You can compile and run them with one press of a button.

Some of the snippets are interactive: you are prompted for input and the result is evaluated and displayed. Others create mini web sites with all the richness of HTML 5.

But the real fun begins when you discover that you can edit these fragments in place. There are exercises at the end of each tutorial that you can solve right there on the spot. You can play with the snippets that generate web pages and watch the effects. You can't get more immediate than that.

Can I create my own content?

Our initial goal was to just publish a few active tutorials, but it quickly became obvious that, if we wanted more content, we'd have to involve the community at large. But to make content creation attractive we had to provide tools. So we implemented an online markup editor and threw in a live preview window. One thing led to another and we ended up with a whole system that lets every user develop their own content and share it with the public. So now we have a little publishing system, which should be very attractive to Haskell programmers.

How cool is it to be able to write a post with embedded runnable and editable Haskell programs? We have already seen very enthusiastic response from our alpha users who immediately started producing amazing content. Some of them decided to move their blogs to the new medium that the School of Haskell offers.

But you don't have to be an experienced Haskell programmer to take advantage or our content creation system. It so happens that the content editor can be easily used as an interactive scratchpad where you can create, compile, and run small Haskell programs. Just surround your code with markdown fences, as in:

``` active haskell
main = putStrLn "Hello Monadic World!"

``` and try running it in the preview pane. We have a full blown Haskell IDE in the works, but this simple scratchpad functionality can liberate many a Haskell newcomer from the drudge of installing the compiler and libraries on their machines.

There is a fairly substantial set of libraries at your disposal when developing contents. They come from the Stackage project. We provide complete Haddock documentation and Hoogle search for those libraries (we are working on providing better UI for those!).

How is it implemented?

We wouldn't have the right to call ourselves a Haskell company if we used anything other than Haskell to implement our software. So everything above the level of Linux and AWS is written in Haskell; and that extends to large parts of the web client written in Fay -- a subset of Haskell that compiles down to JavaScript. And, frankly, I can't imagine accomplishing so much in such a short time with such a small team if we didn't use Haskell and Haskell libraries.

In particular Michael Snoyman's Haskell web framework Yesod was perfect for building a highly interactive modern web site sitting on top of a database and AWS cloud services, smoothly interacting with git and the GHC compiler. (It doesn't hurt that Michael is our development lead.)

Naturally, we had to create some Yesod tutorials for the School of Haskell. But Yesod is used to implement web sites -- servers that serve HTML pages over HTTP. So how do we embed live Yesod code in a tutorial? First we have to send the code to our cloud, compile and run it. The resulting web server has to listen to a port, which we provide, and send HTTP responses out to the Internet. Since this server is to be accessed over the Internet, we have to generate a temporary URL for it. In the meanwhile, client code opens a little browser within a browser and displays it in an iFrame. It then sends a request to the above mentioned web server using the temporary URL, receives the page back, and displays it.

Conclusions

We believe that Haskell is the future of programming and that education is the first step on the path to its widespread industry adoption. To this end we have created a one-stop learning facility for both newcomers and seasoned Haskellers. We really hope that you will enjoy interacting with the School of Haskell and help it grow as a resource for the whole programming community.

Acknowledgment

None of this would have been possible without the Haskell community and the ecosystem of compilers, libraries, packages, and tools that have been developed over decades.

comments powered by Disqus