----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Indexed -- Copyright : (C) 2008 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett -- Stability : experimental -- Portability : portable -- ---------------------------------------------------------------------------- module Control.Comonad.Indexed ( module Control.Comonad , Control.Functor.Pointed.Indexed.IxPointed(..) , Control.Functor.Pointed.Indexed.IxCopointed(..) , IxComonad(..) , iduplicate ) where import Control.Comonad import Control.Functor.Pointed.Indexed class IxCopointed w => IxComonad w where iextend :: (w j k a -> b) -> w i k a -> w i j b iduplicate :: IxComonad w => w i k a -> w i j (w j k a) iduplicate = iextend id instance Comonad w => IxComonad (LiftIx w) where iextend f = LiftIx . extend (f . LiftIx) . lowerIx