Skip to content

Instantly share code, notes, and snippets.

@ericmoritz
Forked from etrepum/error_m.erl
Created June 9, 2013 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericmoritz/5745459 to your computer and use it in GitHub Desktop.
Save ericmoritz/5745459 to your computer and use it in GitHub Desktop.
-module(error_m).
-export([return/1, fail/1, bind/2]).
return(V) -> {ok, V}.
fail(V) -> {error, V}.
bind({ok, V}, F) -> F(V);
bind(Err={error, _}, _F) -> Err.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment