A Git Repo with Working Examples Accompanying the Haskell Framework IHP's Documentation: ihp-guide

, Haskell


Here it is: gitlab.com/fritzfeger/ihp-guide

IHP

Haskell is famous for its steep learning curve. The Haskell framework IHP is advertised as “The Haskell Framework for Non-Haskellers”, which is, on the one hand, quite an optimistic claim, as the moment where genuine Haskell programming is necessary will inevitably arrive. On the other hand, IHP comes to the rescue in at least four significant ways:

  1. a basic example blog can be created with just one command ihp-new, blog posts can be created on localhost right away;
  2. types are automatically built from the data model in the PostgreSQL database;
  3. a code generation tool creates functionality employing a well-designed Model-View-Controller setup, enabling basic CRUD operation in a web app;
  4. there is extensive documentation and a supportive crowd to get you going.

The IHP Documentation

The documentation, formerly known as “Guide” (which is still in it’s URL), immediately turns to explaining and then extending the auto-generated code. The first exercise is to add comments to the example project’s blog posts by adapting the autogenerated code, which means you’re right into writing Haskell, or at least copying and pasting Haskell ;-)

The more advanced the topics, the more concise the docs - which is fine! Yet inescapably what’s left out because obvious to the advanced ones, makes it more difficult for us beginners to get those sought-after features to actually work.

The Working-Examples Repo ihp-guide

Together with Sascha Gresk, I’ve started a project to fill this gap - and at the same time of course as a vehicle for our own IHP learning! ihp-guide features the example blog from the IHP Guide as master branch.

Functionality described in the course of the docs aka the Guide are available one by one as individual feature branches, branched from master unless otherwise indicated. To keep it simple and to ease identification of relevant changes and additions, the master goes without the commenting functionality, i.e. remains as lean as possible. The branches are named in correspondence with the Guide headings and/or URLs. Comments and a handy link to the diff to master can be found in the README of the respective branch.

Run the Examples on Your Local Machine

The master branch’s README has a couple of hints on possible obstacles, but generally it should be possible just to clone the repository, go to a feature branch and start the IHP web server locally to see it work.

Contribute

ihp-guide is 100% open for anyone to use and to contribute. Feel free to raise an issue or to submit a pull request!

What follows is the state of affairs at the time of this blog post. There’s still a lot to do!

GETTING STARTED

THE BASICS

Routing

Views & JSON

Forms

ADVANCED

FRONTEND

DATABASE

AUTH

RECIPES

TROUBLESHOOTING

NOT YET IN THE GUIDE