Skip to content

Instantly share code, notes, and snippets.

@chessai
Created February 26, 2019 15:51
Show Gist options
  • Save chessai/4d636210edeb4b01cd568a736d7dcae0 to your computer and use it in GitHub Desktop.
Save chessai/4d636210edeb4b01cd568a736d7dcae0 to your computer and use it in GitHub Desktop.
combine :: Monoid e
=> (a -> Either e r1)
-> (b -> Either e r2)
-> (a,b)
-> Either (Either e1 (e1,e2)) (r1,r2)
combine fa fb (a,b) =
let faa = fa a
fbb = fb b
in case faa of
Left e1 -> Left (Left e1)
Right r1 -> case fbb of
Left e2 ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment