Last active
August 29, 2015 14:03
-
-
Save reinh/ea7afa7187139e64820d 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
data Thing = Thing | |
{ _foo :: Int | |
, _bar :: String } | |
buildFoo :: Other -> Thing | |
buildfoo = Thing <$> buildFoo | |
<*> buildBar | |
where buildFoo :: Other -> Int | |
buildFoo = undefined | |
buildBar :: Other -> String | |
buildBar = undefined | |
buildThingThatMightError :: Other -> Either String Thing | |
buildThingThatMightError = undefined -- ????? | |
where buildFoo :: Other -> Either String Int | |
buildFoo = undefined | |
buildBar :: Other -> Either String String | |
buildBar = undefined | |
-- Switch to Either applicative like this | |
buildThingThatMightError' other = Thing <$> buildFoo other | |
<*> buildBar other |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment