A Result
is either Ok
meaning the computation succeeded, or it is an
Err
meaning that there was some failure.
Transform an Err
value. For example, say the errors we get have too much
information:
parseInt : String -> Result ParseError Int
type alias ParseError =
{ message : String
, code : Int
, position : (Int,Int)
}
mapError .message (parseInt "123") == Ok 123
mapError .message (parseInt "abc") == Err "char 'a' is not a number"
Generated using TypeDoc
Result