Last active
August 29, 2015 14:18
-
-
Save isovector/9557b521a435a38ead42 to your computer and use it in GitHub Desktop.
MONAD HELL
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
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 | |
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
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