Initial commit of Lift datatype
This commit is contained in:
parent
4fd31a60fb
commit
7882899b21
1 changed files with 7 additions and 0 deletions
|
@ -49,6 +49,13 @@ instance C.Category (:~>) where
|
||||||
instance Enter (m a) (m :~> n) (n a) where
|
instance Enter (m a) (m :~> n) (n a) where
|
||||||
enter (Nat f) = f
|
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`.
|
-- | Like `lift`.
|
||||||
liftNat :: (Control.Monad.Morph.MonadTrans t, Monad m) => m :~> t m
|
liftNat :: (Control.Monad.Morph.MonadTrans t, Monad m) => m :~> t m
|
||||||
liftNat = Nat Control.Monad.Morph.lift
|
liftNat = Nat Control.Monad.Morph.lift
|
||||||
|
|
Loading…
Reference in a new issue