Initial commit of Lift datatype

This commit is contained in:
David Johnson 2016-11-17 15:27:41 -06:00
parent 4fd31a60fb
commit 7882899b21

View file

@ -49,6 +49,13 @@ instance C.Category (:~>) where
instance Enter (m a) (m :~> n) (n a) where
enter (Nat f) = f
-- | A lifting function from @a@ to @n a@. Used to `enter` particular
-- datatypes.
newtype x :^ n = Lift { unLift :: forall a. a -> n a} deriving Typeable
instance Enter a (a :^ n) (n a) where
enter (Lift f) = f
-- | Like `lift`.
liftNat :: (Control.Monad.Morph.MonadTrans t, Monad m) => m :~> t m
liftNat = Nat Control.Monad.Morph.lift