Crash Course outdated

24 views
Skip to first unread message

Tomás Ferrer

unread,
Jan 11, 2021, 11:45:33 AM1/11/21
to HAppS
Hi,
I was interested in using happstack, mostly applying my knowledge on functional programming (which is still quite scarce) and I really liked the fact that happstack has a very detailed crash course in their official website here. So i tried initializing a project, and I had issues in multiple steps, some of which I could not resolve.
First of all, I had issues installing happstack. I followed this guide and installed happstack successfully, but both this command:
```bash
ghc --make -threaded HelloWorld.hs -o helloworld
```
And this command:
```bash
runhaskell HelloWorld.hs
```
did not seem to find a happstack installation. I solved it by running `cabal v1-install happstack-server` instead of `cabal install happstack-server`. As it seems, cabal changed their entire interface but still kept the old commands. So this installation guide is clearly outdated. I tried using the latest versions of all modules, using GHC 8.8.4.
The next two tutorial steps worked quite well (HelloWorld and routing incoming requests). I was really excited! But then came the Templating part.
The HSX tutorial is clearly outdated as the `hsx` package is deprecated and `happstack-hsp` now uses `hsx2hs`. so this line:
`{-# OPTIONS_GHC -F -pgmF trhsx #-}` is now invalid. I replaced it with `{-# OPTIONS_GHC -F -pgmFhsx2hs #-}`
Also, `happstack-hsp` doesn't have the `HSP.Identity` module since version 7.1.2, which was released a very long time ago. The tutorial still imports this module.
Removing the import, i could still not get these lines of code working:
```haskell
where
getMethod :: XMLGenT (ServerPartT IO) String
getMethod = show . rqMethod <$> askRq
```
I added the imports 

```
import Happstack.Server.XMLGenT
import HSP.XML
```
but still there were issues finding the `XMLGenT` constructor. So I gave up and tried to downgrade all dependencies. Which led me to the following problem: one of the dependencies requires a very old version of the base module (specifically, it needed Haskell 7.8.3 (2014.2.0.0)). This version is so old I could not install it with ghcup neither on macOS or Ubuntu, and the compilation failed in Ubuntu 18.04. I think I couldn't even install it on Windows 10 with Chocolatey, the compilation failed as well if I remember correctly.
It would be awesome if the crash course could be updated. I could not find many resources online and finally I gave up and tried using yesod, which has a somewhat newer documentation. I don't think people would use happstack anymore if the documentation is so outdated.

Thank you for reading until the end! 

Jeremy Shaw

unread,
Jan 11, 2021, 4:50:49 PM1/11/21
to HAppS
Hello,

It looks like a very old version of the crashcourse got uploaded. I have uploaded a much newer version,

http://happstack.com/docs/crashcourse/index.html

There are still some parts of the book which should be updated -- but I just confirmed that in the version that is live now, all the examples actually compile with GHC 8.6 and the latest versions of Happstack and friends.

- jeremy

Tomás Ferrer

unread,
Jan 11, 2021, 6:42:12 PM1/11/21
to HAppS
Thanks a lot! I'm gonna give it a try.
Reply all
Reply to author
Forward
0 new messages