{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 704
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
module Control.Comonad.Hoist.Class
( ComonadHoist(cohoist)
) where
import Control.Comonad
import Control.Monad.Trans.Identity
class ComonadHoist t where
cohoist :: (Comonad w, Comonad v) => (forall x. w x -> v x) -> t w a -> t v a
instance ComonadHoist IdentityT where
cohoist :: forall (w :: * -> *) (v :: * -> *) a.
(Comonad w, Comonad v) =>
(forall x. w x -> v x) -> IdentityT w a -> IdentityT v a
cohoist forall x. w x -> v x
l = forall {k} (f :: k -> *) (a :: k). f a -> IdentityT f a
IdentityT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. w x -> v x
l forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). IdentityT f a -> f a
runIdentityT
{-# INLINE cohoist #-}