Skip to content

Instantly share code, notes, and snippets.

@isovector
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isovector/9557b521a435a38ead42 to your computer and use it in GitHub Desktop.
Save isovector/9557b521a435a38ead42 to your computer and use it in GitHub Desktop.
MONAD HELL
type App = ReaderT (AcidState Database) (ServerPartT IO)
processForm :: App Response
processForm =
do method POST
db <- ask
(games, _) <- query db (GetState) ----- this part explodes
prefs <- sequence $ map (runText . fst) prefMap
ok $ template "form" $ H.p "success!"
main :: IO ()
main =
do database <- openLocalState $ Database [] []
simpleHTTP nullConf $ do
decodeBody (defaultBodyPolicy "/tmp/" 4096 4096 4096)
runReaderT processForm database
src/Haystack/Web/Preferences.hs:79:28:
Couldn't match type `IO'
with `ReaderT (AcidState Database) (ServerPartT IO)'
Expected type: ReaderT
(AcidState Database) (ServerPartT IO) (EventResult GetState)
Actual type: IO (EventResult GetState)
In the return type of a call of `query'
In a stmt of a 'do' block: (games, _) <- query db (GetState)
In the expression:
do { method POST;
db <- ask;
(games, _) <- query db (GetState);
prefs <- sequence $ map (runText . fst) prefMap;
.... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment