Skip to content

Instantly share code, notes, and snippets.

@reinh
Created July 6, 2013 23:17
Show Gist options
  • Save reinh/5941633 to your computer and use it in GitHub Desktop.
Save reinh/5941633 to your computer and use it in GitHub Desktop.
import Monad
@doc """
Read and decode a file
Returns {:ok, result} or {:error, reason}
"""
def decode_file(fh) do
monad ErrorM do
contents <- File.read(fh)
decode contents
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment