diff --git a/servant/src/Servant/Utils/Enter.hs b/servant/src/Servant/Utils/Enter.hs index 12f7a530..505e7ef3 100644 --- a/servant/src/Servant/Utils/Enter.hs +++ b/servant/src/Servant/Utils/Enter.hs @@ -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