mantra-0.4.0.0
Safe HaskellNone
LanguageHaskell2010

Mantra.Types

Description

Mantra types.

Synopsis

Mantra monad

newtype MantraM m a Source #

Mantra monad.

Constructors

MantraM 

Fields

Instances

Instances details
Monad m => MonadError String (MantraM m) Source # 
Instance details

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 # 
Instance details

Defined in Mantra.Types

Methods

(>>=) :: MantraM m a -> (a -> MantraM m b) -> MantraM m b

(>>) :: MantraM m a -> MantraM m b -> MantraM m b

return :: a -> MantraM m a

Functor m => Functor (MantraM m) Source # 
Instance details

Defined in Mantra.Types

Methods

fmap :: (a -> b) -> MantraM m a -> MantraM m b

(<$) :: a -> MantraM m b -> MantraM m a

MonadFail m => MonadFail (MantraM m) Source # 
Instance details

Defined in Mantra.Types

Methods

fail :: String -> MantraM m a

Monad m => Applicative (MantraM m) Source # 
Instance details

Defined in Mantra.Types

Methods

pure :: a -> MantraM m a

(<*>) :: MantraM m (a -> b) -> MantraM m a -> MantraM m b

liftA2 :: (a -> b -> c) -> MantraM m a -> MantraM m b -> MantraM m c

(*>) :: MantraM m a -> MantraM m b -> MantraM m b

(<*) :: MantraM m a -> MantraM m b -> MantraM m a

MonadIO m => MonadIO (MantraM m) Source # 
Instance details

Defined in Mantra.Types

Methods

liftIO :: IO a -> MantraM m a

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

logMantra Source #

Arguments

:: MonadIO m 
=> Bool

Whether to log to standard output.

-> String

The message.

-> MantraM m ()

Action to log the message.

Log a message.

printMantra Source #

Arguments

:: MonadIO m 
=> String

The message.

-> MantraM m ()

Action to print the message.

Print a message to standard output.

debugMantra Source #

Arguments

:: MonadIO m 
=> String

The message.

-> MantraM m ()

Action to print the message.

Print a message to standard error.

Lifting and hoisting

foistMantra Source #

Arguments

:: Monad m 
=> a

The value.

-> MantraM m a

Action for the value.

Pull a value into the Mantra monad.

foistMantraEither Source #

Arguments

:: Monad m 
=> Show e 
=> Either e a

The value.

-> MantraM m a

Action for the value.

Pull a value into the Mantra monad.

foistMantraEitherIO Source #

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.

foistMantraExcept Source #

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.

foistMantraExceptIO Source #

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.

foistMantraMaybe Source #

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.

foistMantraMaybeIO Source #

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

throwMantra Source #

Arguments

:: Monad m 
=> String

The error message.

-> MantraM m a

Action for throwing the error.

Throw an error.

Slots

data SlotRef Source #

A reference to a slot.

Constructors

AbsoluteSlot Integer

The absolute slot number.

RelativeSlot Integer

The number of slots relative to the current tip.

Instances

Instances details
Eq SlotRef Source # 
Instance details

Defined in Mantra.Types

Methods

(==) :: SlotRef -> SlotRef -> Bool

(/=) :: SlotRef -> SlotRef -> Bool

Ord SlotRef Source # 
Instance details

Defined in Mantra.Types

Methods

compare :: SlotRef -> SlotRef -> Ordering

(<) :: SlotRef -> SlotRef -> Bool

(<=) :: SlotRef -> SlotRef -> Bool

(>) :: SlotRef -> SlotRef -> Bool

(>=) :: SlotRef -> SlotRef -> Bool

max :: SlotRef -> SlotRef -> SlotRef

min :: SlotRef -> SlotRef -> SlotRef

Read SlotRef Source # 
Instance details

Defined in Mantra.Types

Methods

readsPrec :: Int -> ReadS SlotRef

readList :: ReadS [SlotRef]

readPrec :: ReadPrec SlotRef

readListPrec :: ReadPrec [SlotRef]

Show SlotRef Source # 
Instance details

Defined in Mantra.Types

Methods

showsPrec :: Int -> SlotRef -> ShowS

show :: SlotRef -> String

showList :: [SlotRef] -> ShowS