Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Universal result type for calculations that may either: produce a value, signal the failure to obtain value, or signal that value is "not interesting".
Documentation
Universal result type for calculations that may either: produce a value, signal the failure to obtain value, or signal that value is "not interesting".
E.g. a text parser distinguishes situations when text file is
"structured enough" to have a syntax error (that's Fail
)
and when text file is not in a supported format at all
(that's Skip
).
toEither :: Outcome a -> Either String a Source
Converts Outcome
into either wrapped value or error message.
exposeOrDie :: Outcome a -> a Source
Either returns a wrapped value or prints out an error message
and terminates the execution with error
.