Created
July 14, 2011 20:36
-
-
Save ocharles/1083378 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modelIO :: IO a -> Model a | |
modelIO action = do | |
Model $ ReaderT (\_ -> action) | |
insertBook :: Book -> Model (LoadedCoreEntity Book) | |
insertBook bookSpec = do | |
bookGid <- (modelIO randomIO) :: Model UUID | |
bookRow <- head `fmap` query insertQuery [ toSql "Hello" ] | |
return $ bookFromRow bookRow | |
where insertQuery = unlines [ "INSERT INTO book (name)" | |
, "VALUES (?)" | |
, "RETURNING *" | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment