Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the simplest way to write web apps in Haskell? [closed]

I would like to use Haskell more for my projects, and I think if I can get started using it for web apps, it would really help that cause. I have tried happs once or twice but had trouble getting off the ground. Are there simpler/more conventional (more like lamp) frameworks out there that I can use or should I just give happs another try?

like image 995
airportyh Avatar asked Sep 09 '08 00:09

airportyh


4 Answers

The best tools as of 2011 are:

  • Snap
  • Yesod; or
  • Happstack

The web development community around Haskell has been thriving on the competition between these communities.

The authors even compare their frameworks here: Comparing Haskell's Snap and Yesod web frameworks

like image 68
Don Stewart Avatar answered Nov 15 '22 17:11

Don Stewart


If you decide to go with HApps you'll probably want to checkout this excellent example driven tutorial that is being developed as a HApps application: HApps Tutorial

like image 44
Jason Dagit Avatar answered Nov 15 '22 15:11

Jason Dagit


I developed MFlow with the idea of the highest functionality/code size ratio. MFlow is made with no other framework in mind, but to use Haskell to the limit to solve the problems of web applications to reduce drastically the noise and the error ratio in web programming. The entire navigation in a MFlow application is safe at compile time. It uses standard web libraries: WAI, formlets, stm, blaze-html..

Judge for yourself: This is a complete application with three pages. In a loop, it ask for two numbers and show the sum. you can press the back button as you please:

module Main where
import MFlow.Wai.Blaze.Html.All

main= do
   addMessageFlows  [("sum", transient . runFlow $ sumIt )]
   wait $ run 8081 waiMessageFlow

sumIt= do
   setHeader $ html . body
   n1 <- ask $  p << "give me the first number"  ++>  getInt Nothing
   n2 <- ask $  p << "give me the second number" ++>  getInt Nothing
   ask $ p << ("the result is " ++ show (n1 + n2)) ++> wlink () << p << "click here"

The state can be made persistent with a little modification.

http://hackage.haskell.org/package/MFlow

There are examples here : http://haskell-web.blogspot.com.es/

like image 4
agocorona Avatar answered Nov 15 '22 15:11

agocorona


Here is a list of web related blog posts about Haskell from the wiki.

Furthermore, the next big Haskell web framework is WASH.

And there is an Apple webobjects based domain specific language.

like image 3
Michiel Overeem Avatar answered Nov 15 '22 17:11

Michiel Overeem