semigroupoids 3.0 → 3.0.0.1
raw patch · 2 files changed
+30/−32 lines, 2 files
Files
- Data/Functor/Extend.hs +29/−31
- semigroupoids.cabal +1/−1
Data/Functor/Extend.hs view
@@ -10,7 +10,8 @@ -- ---------------------------------------------------------------------------- module Data.Functor.Extend- ( -- * $definition+ ( -- * Extendable Functors+ -- $definition Extend(..) ) where @@ -27,11 +28,11 @@ class Functor w => Extend w where -- |- -- > duplicate = extend id- -- > fmap (fmap f) . duplicate = duplicate . fmap f+ -- > duplicated = extended id+ -- > fmap (fmap f) . duplicated = duplicated . fmap f duplicated :: w a -> w (w a) -- |- -- > extend f = fmap f . duplicate+ -- > extended f = fmap f . duplicated extended :: (w a -> b) -> w a -> w b extended f = fmap f . duplicated@@ -93,30 +94,27 @@ [] -> [] (a:as) -> toList (extended f (a :| as)) -{- $definition--There are two ways to define an 'Extend' instance:--I. Provide definitions for 'extend'-satisfying this law:--> extended f . extended g = extended (f . extended g)--II. Alternately, you may choose to provide definitions for 'duplicate'-satisfying this laws:--> duplicated . duplicated = fmap duplicated . duplicated--These are both equivalent to the statement that (->-) is associative--> (f ->- g) ->- h = f ->- (g ->- h)--You may of course, choose to define both 'duplicate' /and/ 'extend'.-In that case you must also satisfy these laws:--> extended f = fmap f . duplicated-> duplicated = extended id--These are the default definitions of 'extended' and 'duplicated'.---}+-- $definition+-- There are two ways to define an 'Extend' instance:+--+-- I. Provide definitions for 'extend'+-- satisfying this law:+--+-- > extended f . extended g = extended (f . extended g)+--+-- II. Alternately, you may choose to provide definitions for 'duplicate'+-- satisfying this law:+--+-- > duplicated . duplicated = fmap duplicated . duplicated+--+-- These are both equivalent to the statement that (->-) is associative+--+-- > (f ->- g) ->- h = f ->- (g ->- h)+--+-- You may of course, choose to define both 'duplicate' /and/ 'extend'.+-- In that case you must also satisfy these laws:+--+-- > extended f = fmap f . duplicated+-- > duplicated = extended id+--+-- These are the default definitions of 'extended' and 'duplicated'.
semigroupoids.cabal view
@@ -1,6 +1,6 @@ name: semigroupoids category: Control, Comonads-version: 3.0+version: 3.0.0.1 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE