Created
August 8, 2015 05:53
-
-
Save ddellacosta/ab6eca193193a030d1ff 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
-- For context, see | |
-- https://github.com/kqr/gists/blob/master/articles/gentle-introduction-monad-transformers.md#introducing-side-effects | |
userLogin :: EitherIO LoginError Text | |
userLogin = do | |
token <- getToken | |
case token of | |
Right domain -> liftIO domain | |
left -> liftEither left | |
-- Errors loading: | |
*Main λ > :l EmailAddr.hs | |
[1 of 1] Compiling Main ( EmailAddr.hs, interpreted ) | |
EmailAddr.hs:60:5: | |
Couldn't match expected type ‘Text’ | |
with actual type ‘Either t0 (IO Text)’ | |
In the pattern: Right domain | |
In a case alternative: Right domain -> liftIO domain | |
In a stmt of a 'do' block: | |
case token of { | |
Right domain -> liftIO domain | |
left -> liftEither left } | |
EmailAddr.hs:61:24: | |
Couldn't match expected type ‘Either LoginError Text’ | |
with actual type ‘Text’ | |
In the first argument of ‘liftEither’, namely ‘left’ | |
In the expression: liftEither left | |
Failed, modules loaded: none. | |
Prelude λ > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment