
On Sat, Jun 20, 2015 at 09:54:27PM +0200, Matthias Beyer wrote:
I am learning Haskell by trying to implement a really simple CRUD like web app with Snap and Groundhog - and I'm completely lost, cannot get it to work.
Since you seem to know what all of those things are, I'm going to assume you have some background in imperative programming. This assumption is backed by your GitHub history. I'm guessing, after the initial few languages, with most programming languages you've encountered thus far, you can learn a new one in a week or two. Haskell isn't like other languages. It requires a fundamentally different manner of thinking about your program. It's like learning to program all over again. It is worth it, I promise. As for learning Haskell, Chris Allen's tutorial has links to resources covering everything under the sun: https://github.com/bitemyapp/learnhaskell. Now, regarding your actual question: what's wrong with the code you have posted? 1. First of all, your dependencies are way too strict in your cabal file. In fact, most of them conflict. I couldn't even run `cabal install`. If you want to make sure the packages play together nicely, you should use Stackage http://www.stackage.org. 2. Nobody uses old versions of base anymore. You don't need that old-base stuff. 3. Your cabal file needs a default-language field. 4. Snap is a bit labor-intensive. Yesod http://www.yesodweb.com is much more well-suited for non-trivial web applications. Once I cleaned up the cabal file, I was able to get the standard Hello, World Snap application running on localhost. I forked your repository on GitHub. You can see the changes I made here: https://github.com/matthiasbeyer/rate.hs/compare/master...pharpend:master. Note that I am using GHC 7.10, which is the latest version. You might be on an old version of GHC, in which case, you should do the following: rm cabal.config cabal install cabal freeze To run the application, I just used `cabal run`. Peter Harpending