The Haskell based Snap Framework is now available via the OpenBSD ports tree. If you enjoy writing your programs in Haskell, you now have a quick and convenient way to establish a base for web application development. Follow these three simple steps to begin writing web applications and web services in Haskell.
First, install the Snap Framework package from your favorite mirror:
The first package, hs-snap-server, installs the server libraries for the Snap Framework and all the necessary dependencies. The hs-heist and hs-xhtml-combinators packages are required for the skeleton web application that Snap will create for you. Heist is a xhtml templating library.
Second, use the snap command to create a starter web application:
Third, compile the start web application from the "src" directory:
Now execute Main and point your web browser at port 8000. You should be greeted with the response "hello world". Give it a try. I would like to know how it works for you.
#> sudo pkg_add -vi hs-snap-server hs-heist hs-xhtml-combinators
The first package, hs-snap-server, installs the server libraries for the Snap Framework and all the necessary dependencies. The hs-heist and hs-xhtml-combinators packages are required for the skeleton web application that Snap will create for you. Heist is a xhtml templating library.Second, use the snap command to create a starter web application:
#> snap init my-web-applicationThird, compile the start web application from the "src" directory:
#> ghc -make MainNow execute Main and point your web browser at port 8000. You should be greeted with the response "hello world". Give it a try. I would like to know how it works for you.
Leave a comment