The Quipper System
Quipper.Utils.Template.ErrorMsgQ
Description
This module provides a simple monad to encapsulate error messages within the Q monad.
Q
type ErrMsg a = Either String a Source #
Shortcut for 'Either String a'.
data ErrMsgQ a Source #
Type for the monad encapsulating error messages.
Constructors
Defined in Quipper.Utils.Template.ErrorMsgQ
Methods
(>>=) :: ErrMsgQ a -> (a -> ErrMsgQ b) -> ErrMsgQ b #
(>>) :: ErrMsgQ a -> ErrMsgQ b -> ErrMsgQ b #
return :: a -> ErrMsgQ a #
fail :: String -> ErrMsgQ a #
fmap :: (a -> b) -> ErrMsgQ a -> ErrMsgQ b #
(<$) :: a -> ErrMsgQ b -> ErrMsgQ a #
pure :: a -> ErrMsgQ a #
(<*>) :: ErrMsgQ (a -> b) -> ErrMsgQ a -> ErrMsgQ b #
liftA2 :: (a -> b -> c) -> ErrMsgQ a -> ErrMsgQ b -> ErrMsgQ c #
(*>) :: ErrMsgQ a -> ErrMsgQ b -> ErrMsgQ b #
(<*) :: ErrMsgQ a -> ErrMsgQ b -> ErrMsgQ a #
errorMsg :: String -> ErrMsgQ a Source #
Set an error message, to be thrown. Usage:
errorMsg "an error happened"
embedQ :: Q a -> ErrMsgQ a Source #
Make a Q computation error-message aware.
extractQ :: String -> ErrMsgQ a -> Q a Source #
Throw the error that has been created, using the given string as a prefix. Usage:
extractQ "name of function: " $ do <<commands that may thow an error>>