Safe Haskell | None |
---|---|
Language | Haskell2010 |
Mantra.Types
Description
Mantra types.
Synopsis
- newtype MantraM m a = MantraM {
- runMantraM :: ExceptT String m a
- mantraM :: Monad m => MonadTrans t => MantraM m a -> t (MantraM m) a
- runMantraToIO :: MantraM IO a -> IO (Either String a)
- logMantra :: MonadIO m => Bool -> String -> MantraM m ()
- printMantra :: MonadIO m => String -> MantraM m ()
- debugMantra :: MonadIO m => String -> MantraM m ()
- foistMantra :: Monad m => a -> MantraM m a
- foistMantraEither :: Monad m => Show e => Either e a -> MantraM m a
- foistMantraEitherIO :: MonadIO m => Show e => IO (Either e a) -> MantraM m a
- foistMantraExcept :: Monad m => Show e => ExceptT e m a -> MantraM m a
- foistMantraExceptIO :: MonadIO m => Show e => ExceptT e IO a -> MantraM m a
- foistMantraMaybe :: Monad m => String -> Maybe a -> MantraM m a
- foistMantraMaybeIO :: MonadIO m => String -> IO (Maybe a) -> MantraM m a
- throwMantra :: Monad m => String -> MantraM m a
- data SlotRef
- = AbsoluteSlot Integer
- | RelativeSlot Integer
Mantra monad
Mantra monad.
Constructors
MantraM | |
Fields
|
Instances
Monad m => MonadError String (MantraM m) Source # | |
Defined in Mantra.Types Methods throwError :: String -> MantraM m a catchError :: MantraM m a -> (String -> MantraM m a) -> MantraM m a | |
Monad m => Monad (MantraM m) Source # | |
Functor m => Functor (MantraM m) Source # | |
MonadFail m => MonadFail (MantraM m) Source # | |
Defined in Mantra.Types | |
Monad m => Applicative (MantraM m) Source # | |
MonadIO m => MonadIO (MantraM m) Source # | |
Defined in Mantra.Types |
mantraM :: Monad m => MonadTrans t => MantraM m a -> t (MantraM m) a Source #
Lift in the Mantra monad.
runMantraToIO :: MantraM IO a -> IO (Either String a) Source #
Run the Mantra monad to IO.
Printing
Arguments
:: MonadIO m | |
=> Bool | Whether to log to standard output. |
-> String | The message. |
-> MantraM m () | Action to log the message. |
Log a message.
Arguments
:: MonadIO m | |
=> String | The message. |
-> MantraM m () | Action to print the message. |
Print a message to standard output.
Arguments
:: MonadIO m | |
=> String | The message. |
-> MantraM m () | Action to print the message. |
Print a message to standard error.
Lifting and hoisting
Arguments
:: Monad m | |
=> a | The value. |
-> MantraM m a | Action for the value. |
Pull a value into the Mantra monad.
Arguments
:: Monad m | |
=> Show e | |
=> Either e a | The value. |
-> MantraM m a | Action for the value. |
Pull a value into the Mantra monad.
Arguments
:: MonadIO m | |
=> Show e | |
=> IO (Either e a) | The value. |
-> MantraM m a | Action for the value. |
Pull a value into the Mantra monad.
Arguments
:: Monad m | |
=> Show e | |
=> ExceptT e m a | The value. |
-> MantraM m a | Action for the value. |
Pull a value into the Mantra monad.
Arguments
:: MonadIO m | |
=> Show e | |
=> ExceptT e IO a | The value. |
-> MantraM m a | Action for the value. |
Pull a value into the Mantra monad.
Arguments
:: Monad m | |
=> String | The error message. |
-> Maybe a | The value. |
-> MantraM m a | Action for the value. |
Pull a value into the Mantra monad.
Arguments
:: MonadIO m | |
=> String | The error message. |
-> IO (Maybe a) | The value. |
-> MantraM m a | Action for the value. |
Pull a value into the Mantra monad.
Exceptions
Arguments
:: Monad m | |
=> String | The error message. |
-> MantraM m a | Action for throwing the error. |
Throw an error.
Slots
A reference to a slot.
Constructors
AbsoluteSlot Integer | The absolute slot number. |
RelativeSlot Integer | The number of slots relative to the current tip. |