-
-
Save stevenfontanella/8ff3c45db26c6de58c0ee891bcfeda4c 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
either1 :: IO (Either String Int) | |
either1 = undefined | |
either2 :: IO (Either String Int) | |
either2 = undefined | |
main1 :: IO Int | |
main1 = do | |
-- to be clear I do not want MonadFail here | |
-- i.e. I don't want to use | |
-- Right a <- either1 | |
a <- fromRight <$> either1 | |
b <- fromRight <$> either2 | |
pure (a + b) | |
{- | |
• Couldn't match type ‘Either a0 (Either String Int) | |
-> Either String Int’ | |
with ‘Int’ | |
Expected type: IO Int | |
Actual type: IO | |
(Either a0 (Either String Int) -> Either String Int) | |
• In a stmt of a 'do' block: pure (a + b) | |
In the expression: | |
do a <- fromRight <$> either1 | |
b <- fromRight <$> either2 | |
pure (a + b) | |
In an equation for ‘main1’: | |
main1 | |
= do a <- fromRight <$> either1 | |
b <- fromRight <$> either2 | |
pure (a + b) | |
-} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment