Skip to content

Instantly share code, notes, and snippets.

@forficate
Created October 11, 2015 07:05
Show Gist options
  • Save forficate/d38492bf8ebdcab5b7b9 to your computer and use it in GitHub Desktop.
Save forficate/d38492bf8ebdcab5b7b9 to your computer and use it in GitHub Desktop.
elm-lang Task snippers
-- Allow both the left / right values of a task to be promted in to a successful Task of c
fold : (a -> c) -> (b -> c) -> Task a b -> Task y c
fold f1 f2 t =
Task.map f2 t `Task.onError` (\x -> Task.succeed(f1 x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment