comonad-1.1.1.6: Haskell 98 compatible comonads

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Data.Functor.Extend

Contents

Description

 

Synopsis

$definition

class Functor w => Extend w whereSource

Methods

duplicate :: w a -> w (w a)Source

 duplicate = extend id
 fmap (fmap f) . duplicate = duplicate . fmap f

extend :: (w a -> b) -> w a -> w bSource

 extend f  = fmap f . duplicate

Instances

Extend [] 
Extend Maybe 
Extend Tree 
Extend Seq 
Extend NonEmpty 
Extend Identity 
Semigroup m => Extend ((->) m) 
Extend (Either a) 
Extend ((,) e) 
Extend w => Extend (IdentityT w) 

(=>>) :: Extend w => w a -> (w a -> b) -> w bSource

extend with the arguments swapped. Dual to >>= for a Monad.

(<<=) :: Extend w => (w a -> b) -> w a -> w bSource

extend in operator form

(=>=) :: Extend w => (w a -> b) -> (w b -> c) -> w a -> cSource

Left-to-right Cokleisli composition

(=<=) :: Extend w => (w b -> c) -> (w a -> b) -> w a -> cSource

Right-to-left Cokleisli composition