-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell 98 comonads -- -- Haskell 98 comonads @package comonad @version 0.6.2 module Control.Comonad -- | $definition class Functor w => Comonad w extract :: Comonad w => w a -> a duplicate :: Comonad w => w a -> w (w a) extend :: Comonad w => (w a -> b) -> w a -> w b -- | extend with the arguments swapped. Dual to >>= for -- a Monad. (=>>) :: Comonad w => w a -> (w a -> b) -> w b -- | extend in operator form (<<=) :: Comonad w => (w a -> b) -> w a -> w b -- | A suitable default definition for fmap for a Comonad. -- Promotes a function to a comonad. -- --
--   fmap f    = extend (f . extract)
--   
liftW :: Comonad w => (a -> b) -> w a -> w b -- | Comonadic fixed point wfix :: Comonad w => w (w a -> a) -> a -- | The Cokleisli Arrows of a given Comonad newtype Cokleisli w a b Cokleisli :: (w a -> b) -> Cokleisli w a b runCokleisli :: Cokleisli w a b -> w a -> b -- | Left-to-right Cokleisli composition (=>=) :: Comonad w => (w a -> b) -> (w b -> c) -> w a -> c -- | Right-to-left Cokleisli composition (=<=) :: Comonad w => (w b -> c) -> (w a -> b) -> w a -> c instance Monad (Cokleisli w a) instance Applicative (Cokleisli w a) instance Functor (Cokleisli w a) instance Comonad w => ArrowChoice (Cokleisli w) instance Comonad w => ArrowApply (Cokleisli w) instance Comonad w => Arrow (Cokleisli w) instance Comonad w => Category (Cokleisli w) instance Typeable1 w => Typeable2 (Cokleisli w) instance Comonad w => Comonad (IdentityT w) instance Comonad Identity instance Monoid m => Comonad ((->) m) instance Comonad ((,) e) module Data.Distributive -- | This is the categorical dual of Traversable -- -- Minimal definition: mapW or distribute -- --
--   mapW = fmap f . duplicate
--   distribute = mapW id
--   
-- -- To be distributable a container will need to have a way to -- consistently zip a potentially infinite number of copies of itself. -- This effectively means that the holes in all values of that type, must -- have the same cardinality, fixed sized vectors, infinite streams, -- functions, etc. and no extra information to try to merge together. class Functor g => Distributive g cotraverse :: (Distributive g, Comonad w) => (w a -> b) -> w (g a) -> g b distribute :: (Distributive g, Comonad w) => w (g a) -> g (w a) -- | Every Distributive is a Functor. This is a valid default -- definition. fmapDefault :: Distributive g => (a -> b) -> g a -> g b instance Distributive g => Distributive (IdentityT g) instance Distributive ((->) e) instance Distributive Identity