The Vectorisation monad.
- data VResult a
- newtype VM a = VM {}
- liftDs :: DsM a -> VM a
- cantVectorise :: String -> SDoc -> a
- maybeCantVectorise :: String -> SDoc -> Maybe a -> a
- maybeCantVectoriseM :: Monad m => String -> SDoc -> m (Maybe a) -> m a
- noV :: VM a
- traceNoV :: String -> SDoc -> VM a
- ensureV :: Bool -> VM ()
- traceEnsureV :: String -> SDoc -> Bool -> VM ()
- onlyIfV :: Bool -> VM a -> VM a
- tryV :: VM a -> VM (Maybe a)
- maybeV :: VM (Maybe a) -> VM a
- traceMaybeV :: String -> SDoc -> VM (Maybe a) -> VM a
- orElseV :: VM a -> VM a -> VM a
- fixV :: (a -> VM a) -> VM a
The Vectorisation Monad
Vectorisation can either succeed with new envionment and a value, or return with failure.
Lifting
Error Handling
cantVectorise :: String -> SDoc -> aSource
Throw a pgmError
saying we can't vectorise something.
maybeCantVectoriseM :: Monad m => String -> SDoc -> m (Maybe a) -> m aSource
Like maybeCantVectorise
but in a Monad
.
Control
traceEnsureV :: String -> SDoc -> Bool -> VM ()Source
Like ensureV
but if we fail then emit some trace message to stderr.
traceMaybeV :: String -> SDoc -> VM (Maybe a) -> VM aSource
Like maybeV
but emit a message to stderr if we fail.