Revision 0efada2a src/Ganeti/BasicTypes.hs
b/src/Ganeti/BasicTypes.hs | ||
---|---|---|
33 | 33 |
, withError |
34 | 34 |
, withErrorT |
35 | 35 |
, toError |
36 |
, toErrorBase |
|
36 | 37 |
, toErrorStr |
37 | 38 |
, Error(..) -- re-export from Control.Monad.Error |
38 | 39 |
, MonadIO(..) -- re-export from Control.Monad.IO.Class |
... | ... | |
229 | 230 |
toError = genericResult throwError return |
230 | 231 |
{-# INLINE toError #-} |
231 | 232 |
|
233 |
-- | Lift a 'ResultT' value into any 'MonadError' with the same base monad. |
|
234 |
toErrorBase :: (MonadBase b m, MonadError e m) => ResultT e b a -> m a |
|
235 |
toErrorBase = (toError =<<) . liftBase . runResultT |
|
236 |
{-# INLINE toErrorBase #-} |
|
237 |
|
|
232 | 238 |
-- | An alias for @withError strMsg@, which is often used to lift a pure error |
233 | 239 |
-- to a monad stack. See also 'annotateResult'. |
234 | 240 |
toErrorStr :: (MonadError e m, Error e) => Result a -> m a |
Also available in: Unified diff