7 ms·
Comparing Haskell Web Frameworks
- nkuttler 13y agoThis is a nice introduction but doesn't really cover much. As a primarily web dev who's just learning some haskell I'd be happy to hear more about data models, controllers, view, etc, whatever there is.
- dobbsbob 13y agoThat's why all the documentation to those projects is linked in this brief intro. Yesod has an entire book too http://www.yesodweb.com/book http://www.yesodweb.com/book though I haven't read it, I assume it covers what you're looking for
- nkuttler 13y agoVery nice thanks. I guess I was just being lazy :)
- tel 13y agoHappstack's tutorials [0][1] are probably the most complete and easy to read. Yesod's book [2] is nice too but I tend to find that it always seems a bit out of date. [0] http://happstack.com/page/view-page-slug/9/happstack-lite http://happstack.com/page/view-page-slug/9/happstack-lite [1] http://happstack.com/docs/crashcourse/index.html http://happstack.com/docs/crashcourse/index.html [2] http://www.yesodweb.com/book http://www.yesodweb.com/book
- danieldk 13y agoEhm: One more step Please complete the security check to access edofic.com Google Cache works though.
- Tehnix 13y agoI personally haven't tried the alternatives, but did research them when before I initially settled on Yesod. Coming from a background of web dev'ing in Python and PHP, I've come to absolutely love Yesod. What I love most about it is that when it compiles, I'm 99% sure it works the way I intended it. This is a huuuuge plus, since I've been used to always having to test in runtime, which adds a lot of overhead and possibility for oversight. This might just be me falling completely in love with Haskell and type inference (not just static typing, Java -.-..), but I'd wager that for any larger codebase/project, the gain from the time saved debugging, would make Haskell (and IMHO Yesod) the optimal choice.
- arianvanp 13y ago`Applicative`'s `<|>` should be `Alternative`'s `<|>`. Alternative is to Applicative what MonadPlus is to Monad. Actually MonadPlus can be defined with just Applicative laws and no Monad laws, that's why MonadPlus will be replaced by Alternative in GHC 7.8.
- losvedir 13y agoYesod is surreal. I experimented with it at one point and tried to change a form field from required to optional. Boom! The whole application wouldn't compile... The properties of the form are reflected in the type system and changing required to optional changed the type. That means I had to track the effect through the application and everywhere that just assumed the data was there had to be updated to handle both cases. It was so restrictive and confusing I gave up for the time being (until I learn Haskell better), but it was an eye-opening glimpse of the power of types.
- Tehnix 13y agoThat's actually one of the reasons I like it. Instead of allowing your application to live in a half-working state, you're required to fix such things. While it might not be as instantly gratifying and being able to refresh and see the page is still working, in the long run it saves a lot of headache.
- jes5199 13y agoI would strongly prefer to work in an environment that detected the error and gave me the power to trace through the app to resolve it while still letting the damn program run in the mostly-working state. The mental cost to review hundreds of lines of code to work out the implications of every change before you can see any results is a problem - it breaks the creative flow, it prevents experimentation.
- lelf 13y agoghc -fdefer-type-errors
- pekk 13y agoI wonder if this isn't an argument for optional typing. Experiment earlier, track down possible bad paths later
- awj 13y agoAren't the errors generated by nonconforming types a way to trace through the app? That's the point of a strong type system: code that by definition won't work isn't allowed to run.
- polymatter 13y agoSorry for the hijack, but if anyone has any tips on Haskell debugging, please share. I loved Yesod, and get such satisfaction when it compiles because of the confidence it gives me that its working as intended. I love the type safe routes :) But I find debugging to be 99% what I do and I am terrible at it. Also, any decent Haskell IDEs out yet? I'm using emacs purely for the syntax highlighting. I tried leksah but I gave up trying to configure it properly on my box.
- edofic 13y agotry hdevtools plugin for your editor.
- Tehnix 13y agoI can recommend VIM with Syntastic[0] and vim2hs[1]. You'd probably also want Vundle to manage plugins though. What I get from that is my code is checked for style/compile errors everytime I save with ghc-mod and hlint. There's also commands to output the type of a function, run haskell code in VIM etc. Note that you need ghc-mod installed for syntastic to take effect though. [0] https://github.com/scrooloose/syntastic https://github.com/scrooloose/syntastic [1] https://github.com/dag/vim2hs https://github.com/dag/vim2hs
- tel 13y agoTurn on -fdefer-type-errors or use the 7.8 beta with type holes. Write your types first. Write whole programs in the style of lalala :: f g Int -> m q -> z () lalala = undefined and then just check and see if your logic holds water. Then, slowly fill in the implementations and use -XImplicitParams and ?f or 7.8 type holes and _ as placeholders that GHC will tell you the goal types of. Reflect as much information about side effects into your types as possible. Write new typeclasses to encapsulate smaller APIs like class Teletype m where writeLine :: String -> m () readLine :: m String instance Teletype IO where writeLine = putStrLn readLine = getLine echo :: Teletype m => m r echo = forever $ readLine >>= writeLine Then now we know what subset of IO `echo` actually uses. Generally, the type system is your friend and used correctly it lets you write a shitty first draft of your program elegantly and quickly and then get to the hard part of typing it out later.
- tel 13y agoSome more annotated resources: 1. http://www.haskell.org/haskellwiki/Web/Comparison_of_Happstack,_Snap_and_Yesod http://www.haskell.org/haskellwiki/Web/Comparison_of_Happsta... A relatively complete listing of resources comparing the three major framework/libraries. A lot of this information is outdated, sadly. 2. http://stackoverflow.com/questions/5645168/comparing-haskells-snap-and-yesod-web-frameworks http://stackoverflow.com/questions/5645168/comparing-haskell... A SO question about comparing Snap and Yesod where both maintainers chime in. The major point of talking here is the Yesod style "Template Haskell" configuration. 3. http://www.reddit.com/r/haskell/comments/l0fne/what_should_i_use_for_web_programming/ http://www.reddit.com/r/haskell/comments/l0fne/what_should_i... A similar question posed to /r/haskell with a great comment by yogostoth demonstrating Yesod. 4. http://softwaresimply.blogspot.com/2012/04/hopefully-fair-and-useful-comparison-of.html http://softwaresimply.blogspot.com/2012/04/hopefully-fair-an... A relatively balanced view comparing the three feature by feature. Again a bit outdated, but well-informed. 5. http://softwaresimply.blogspot.com/2012/12/haskell-web-framework-matrix_20.html http://softwaresimply.blogspot.com/2012/12/haskell-web-frame... And finally my favorite summary of the whole thing: the Web Framework matrix which considers each as a web programming embedded DSL and talks about their relative merits in a 2x2 table.
- virtualwhys 13y agoYesod looks very interesting. If I jump ship from Scala + Play framework to Haskell, Yesod will be my first choice, batteries included and then some. Anyone know if a Haskell IDE is in the works? Certainly would help to be able to mouse hover-view type, or mouse click-go to source declaration a la Eclipse/IntelliJ/Visual Studio, etc., particularly for beginners, imagine that's a pretty big time sink in learning the language...
- niels 13y agoThere is eclipsefp. http://eclipsefp.github.io/ http://eclipsefp.github.io/
- virtualwhys 13y agoThanks, am an Eclipse user so this might be just what the doctor ordered ;-)
- croyd 13y agoFP Complete has a web IDE: https://www.fpcomplete.com/business/fp-haskell-center/ https://www.fpcomplete.com/business/fp-haskell-center/
- twopoint718 13y agoThere's also Leksah http://leksah.org/ http://leksah.org/ . I used this a bit a few years ago. It does on-the-fly recompiles, reports errors, and shows type signatures.
- taejo 13y agoI've used Yesod for a small webapp. The type-safety is amazing. For a simpler project, I've used a small subset of Snap. Well, the HTTP side was simpler: it was a game with the front-end completely in JS, and the server in Haskell; all Snap did was shunt JSON back and forth through a few routes for creating a new game, getting the updated game state, posting a move, etc. Both are nice, depending on what you need, but for your average Django or RoR developer, Yesod gives the most bang for the buck in terms of learning a completely different paradigm.
- embwbam 13y agoAs a beginner, if you're looking for something a little more familiar try Scotty - https://github.com/scotty-web/scotty https://github.com/scotty-web/scotty It's just like using Sinatra or Express. It doesn't provide any url type-safety or magic, but that is also why it is easier to use.