Safe Haskell | None |
---|---|
Language | Haskell2010 |
Extensions |
|
Synopsis
- type Result = ResultT Identity
- pattern Result :: Either String a -> Result a
- pattern Error :: String -> Result a
- pattern Success :: a -> Result a
- runResult :: Result a -> Either String a
- result :: (String -> b) -> (a -> b) -> Result a -> b
- fromEither :: Either String a -> Result a
- toEither :: Result a -> Either String a
- fromSuccess :: a -> Result a -> a
- toMonadFail :: MonadFail m => Result a -> m a
Documentation
result :: (String -> b) -> (a -> b) -> Result a -> b Source #
Case analysis for the Result
type.
Examples
>>>
let s = Success 0
>>>
let e = Error "critical"
>>>
result ("Bad: " ++) (("OK: " ++) . show) s
"OK: 0">>>
result ("Bad: " ++) (("OK: " ++) . show) e
"Bad: critical"
fromSuccess :: a -> Result a -> a Source #
Convert
to Result
aa
with a default value.