[Haskell-beginners] Help - I'm completely lost with building a really simple app with Snap and Groundhog

Matthias Beyer mail at beyermatthias.de
Sun Jun 21 09:23:01 UTC 2015


Hi,

thanks a lot for your reply. Answer is inline:

On 20-06-2015 17:53:24, Peter Harpending wrote:
> And I just realized I based all of this off of what was in the master
> branch. Oh well. See if it's helpful anyway.
> 

nvm, I'll read through it and apply onto my branch, thanks!

> 
> On Sat, Jun 20, 2015 at 05:50:49PM -0600, Peter Harpending wrote:
> > 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.

There is no need to convince me! I already lost my soul to FP and Haskell! I
know the concept is completely different from what I've learned so far, and I
know I have to re-learn things, but I also know that it's worth it!

> > 
> > As for learning Haskell, Chris Allen's tutorial has links to resources
> > covering everything under the sun:
> > <https://github.com/bitemyapp/learnhaskell>.
> > 

Thanks for reminding me of this!


> > Now, regarding your actual question: what's wrong with the code you have
> > posted?

My problem was that I didn't get groundhog to be integrated in my web app. I
already solved this, as you can see here:

    https://github.com/matthiasbeyer/rate.hs/tree/restart_clean

But still, I am not able to get my migrations running.

> > 
> > 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`.
> > 

Hm. I can run `cabal configure` without problems. I did not run `cabal install`,
though, as I'm on nixos and it won't work anyways!

> >    If you want to make sure the packages play together nicely, you
> >    should use Stackage <http://www.stackage.org>.
> > 

I'm using the cabal packages from nixos (haskellngPackages set). I'm not sure
how to know whether they play nicely together or not...

> > 2. Nobody uses old versions of base anymore. You don't need that
> >    old-base stuff.

Ok, will remove it. It is what `snap init` gave me, as far as I can remember!

> > 
> > 3. Your cabal file needs a default-language field.

Will add that.

> > 
> > 4. Snap is a bit labor-intensive. Yesod <http://www.yesodweb.com> is
> >    much more well-suited for non-trivial web applications.

I won't switch to yesod. Yesod is far more complex as far as I can tell. It
might be well suited for the app I want to write after this one, which will be
much more complex, but I guess I will still stick with Snap as it is (IMHO)
easier to learn.

Maybe you can convince me here.

> > 
> > 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:

I'm on GHC 7.10.1, thanks! NixOS ships the latest, thankfully! :-)

-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer

Proudly sent with mutt.
Happily signed with gnupg.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150621/ac29aa09/attachment.sig>


More information about the Beginners mailing list