Skip to content

Commit

Permalink
Merge pull request #10 from nrolland/lesson-8
Browse files Browse the repository at this point in the history
update memoise.cabal and fix Main.hs
  • Loading branch information
Ryan Trinkle committed Jun 8, 2015
2 parents 5ed5a20 + 76ce606 commit a3c844a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 7 additions & 6 deletions memoise.cabal
Expand Up @@ -15,13 +15,14 @@ Executable memoise
Hs-source-dirs: src
Main-is: Main.hs
Build-depends: base >= 4 && < 5
, snap >= 0.12 && < 0.13
, snap >= 0.12
, snap-core >= 0.9 && < 0.10
, snap-extras >= 0.6 && < 0.7
, heist >= 0.12 && < 0.13
, lens >= 3.9 && < 3.10
, text >= 0.11 && < 0.12
, snaplet-postgresql-simple >= 0.4 && < 0.5
, snap-extras >= 0.6
, heist >= 0.12
, lens >= 3.9
, text >= 0.11
, snaplet-postgresql-simple >= 0.4
, mtl
GHC-options: -threaded -O2
Extensions: OverloadedStrings
, TemplateHaskell
Expand Down
9 changes: 7 additions & 2 deletions src/Main.hs
@@ -1,3 +1,6 @@
{-# LANGUAGE FlexibleInstances, UndecidableInstances #-}
{-# LANGUAGE ConstraintKinds #-}

import Snap
import Snap.Snaplet.Heist
import Snap.Snaplet.PostgresqlSimple
Expand All @@ -9,7 +12,9 @@ import Data.Text.Encoding
import Data.Monoid
import Heist
import Heist.Interpreted

import Control.Monad.Trans
import Control.Monad.State

data Memoise
= Memoise { _heist :: Snaplet (Heist Memoise)
, _db :: Snaplet Postgres
Expand Down Expand Up @@ -52,7 +57,7 @@ mainTextboxAttributeSplice _ = do
memoiseInit :: SnapletInit Memoise Memoise
memoiseInit = makeSnaplet "memoise" "The world's laziest hyperlink shortener" Nothing $ do
h <- nestSnaplet "heist" heist $ heistInit "templates"
modifyHeistState $ bindAttributeSplices [("main-textbox", mainTextboxAttributeSplice)]
modifyHeistState $ bindAttributeSplices ("main-textbox" ## mainTextboxAttributeSplice)
d <- nestSnaplet "db" db pgsInit
addRoutes [ ("static", serveDirectory "static")
, ("", indexHandler)
Expand Down

0 comments on commit a3c844a

Please sign in to comment.