category-extras-0.44.2: src/Control/Functor/Pointed/Indexed.hs
-------------------------------------------------------------------------------------------
-- |
-- Module : Control.Functor.Pointed.Indexed
-- Copyright : 2008 Edward Kmett
-- License : BSD3
--
-- Maintainer : Edward Kmett <ekmett@gmail.com>
-- Stability : experimental
-- Portability : portable
--
-------------------------------------------------------------------------------------------
module Control.Functor.Pointed.Indexed
( IxPointed(..)
, IxCopointed(..)
, module Control.Functor.Indexed
, module Control.Functor.Pointed
)where
import Control.Functor.Pointed
import Control.Functor.Indexed
class IxFunctor m => IxPointed m where
ireturn :: a -> m i i a
class IxFunctor w => IxCopointed w where
iextract :: w i i a -> a
instance Pointed m => IxPointed (LiftIx m) where
ireturn = LiftIx . point
instance Copointed m => IxCopointed (LiftIx m) where
iextract = extract . lowerIx
{-# RULES
"ireturn/iextract" ireturn . iextract = id
"iextract/ireturn" iextract . ireturn = id
#-}