Portability | ghc |
---|---|
Stability | beta |
Maintainer | Neil Sculthorpe <neil@ittc.ku.edu> |
Safe Haskell | Safe-Infered |
- class Injection a b where
- injectM :: (Monad m, Injection a a') => a -> m a'
- retractM :: (MonadCatch m, Injection a a') => a' -> m a
- injectT :: (Monad m, Injection a a') => Translate c m a a'
- retractT :: (MonadCatch m, Injection a a') => Translate c m a' a
- extractT :: (Monad m, Injection a a') => Translate c m a' b -> Translate c m a b
- promoteT :: (MonadCatch m, Injection a a') => Translate c m a b -> Translate c m a' b
- promoteWithFailMsgT :: (MonadCatch m, Injection a a') => String -> Translate c m a b -> Translate c m a' b
- extractR :: (MonadCatch m, Injection a a') => Rewrite c m a' -> Rewrite c m a
- promoteR :: (MonadCatch m, Injection a a') => Rewrite c m a -> Rewrite c m a'
- extractWithFailMsgR :: (MonadCatch m, Injection a a') => String -> Rewrite c m a' -> Rewrite c m a
- promoteWithFailMsgR :: (MonadCatch m, Injection a a') => String -> Rewrite c m a -> Rewrite c m a'
- injectL :: (MonadCatch m, Injection a a') => Lens c m a a'
- retractL :: (MonadCatch m, Injection a a') => Lens c m a' a
Injection Class
class Injection a b whereSource
A class of injective functions from a
to b
, and their retractions.
The following law is expected to hold:
retract (inject a) == Just a
Monad Injections
retractM :: (MonadCatch m, Injection a a') => a' -> m aSource
Retracts a value and lifts it into a MonadCatch
, with the possibility of failure.
Translate Injections
retractT :: (MonadCatch m, Injection a a') => Translate c m a' aSource
promoteWithFailMsgT :: (MonadCatch m, Injection a a') => String -> Translate c m a b -> Translate c m a' bSource
As promoteT
, but takes a custom error message to use if promotion fails.
Rewrite Injections
extractWithFailMsgR :: (MonadCatch m, Injection a a') => String -> Rewrite c m a' -> Rewrite c m aSource
As extractR
, but takes a custom error message to use if extraction fails.
promoteWithFailMsgR :: (MonadCatch m, Injection a a') => String -> Rewrite c m a -> Rewrite c m a'Source
As promoteR
, but takes a custom error message to use if promotion fails.