Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Yesod
import Database.Persist
import Database.Persist.MongoDB
import Database.MongoDB.Connection (ConnPool)
mkPersist [persist|
Person
name String
age Int
|]
runMongo :: MongoDBReader t (GGHandler M M IO) a -> GHandler M M a
runMongo x = liftIOHandler $ runMongoDBConn x getConnection
getConnection :: (ConnPool t, HostName)
getConnection = undefined
someAction :: Monad m => MongoDBReader t m (Key Person)
someAction = insert $ Person "Bob" 20
-- selectList [PersonIdIn [1,2]] [] 0 0
data M = M
instance Yesod M where approot _ = ""
mkYesod "M" [parseRoutes|/ RootR GET|]
getRootR :: GHandler M M RepHtml
getRootR = do
_ <- runMongo someAction
defaultLayout [hamlet|<h1>HELLO WORLD|]
main :: IO ()
main = warpDebug 3000 M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.