packages feed

semigroupoids 4.0 → 4.0.1

raw patch · 11 files changed

+32/−29 lines, 11 files

Files

semigroupoids.cabal view
@@ -1,6 +1,6 @@ name:          semigroupoids category:      Control, Comonads-version:       4.0+version:       4.0.1 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE
src/Data/Functor/Apply.hs view
@@ -13,11 +13,11 @@ -- Portability :  portable -- -----------------------------------------------------------------------------module Data.Functor.Apply ( +module Data.Functor.Apply (   -- * Functors     Functor(..)   , (<$>)     -- :: Functor f => (a -> b) -> f a -> f b-  , ( $>)     -- :: Functor f => f a -> b -> f b +  , ( $>)     -- :: Functor f => f a -> b -> f b    -- * Apply - a strong lax semimonoidal endofunctor 
src/Data/Functor/Bind.hs view
@@ -56,7 +56,9 @@ import Control.Comonad.Trans.Store import Control.Comonad.Trans.Traced import Control.Monad (ap)-import Control.Monad.Instances+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707+import Control.Monad.Instances ()+#endif import Control.Monad.Trans.Cont import Control.Monad.Trans.Error import Control.Monad.Trans.Identity
src/Data/Functor/Bind/Trans.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module      :  Data.Functor.Bind.Trans@@ -9,13 +10,15 @@ -- Portability :  portable -- -----------------------------------------------------------------------------module Data.Functor.Bind.Trans ( +module Data.Functor.Bind.Trans (   BindTrans(..)   ) where  -- import _everything_ import Control.Category-import Control.Monad.Instances+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707+import Control.Monad.Instances ()+#endif import Control.Monad.Trans.Class import Control.Monad.Trans.Cont -- import Control.Monad.Trans.Error@@ -41,7 +44,7 @@   liftB = IdentityT  instance BindTrans (ReaderT e) where-  liftB = ReaderT . const +  liftB = ReaderT . const  instance (Semigroup w, Monoid w) => BindTrans (Lazy.WriterT w) where   liftB = Lazy.WriterT . fmap (\a -> (a, mempty))@@ -50,14 +53,14 @@   liftB = Strict.WriterT . fmap (\a -> (a, mempty))  instance BindTrans (Lazy.StateT s) where-  liftB m = Lazy.StateT $ \s -> fmap (\a -> (a, s)) m +  liftB m = Lazy.StateT $ \s -> fmap (\a -> (a, s)) m  instance BindTrans (Strict.StateT s) where-  liftB m = Strict.StateT $ \s -> fmap (\a -> (a, s)) m +  liftB m = Strict.StateT $ \s -> fmap (\a -> (a, s)) m  instance (Semigroup w, Monoid w) => BindTrans (Lazy.RWST r w s) where   liftB m = Lazy.RWST $ \ _r s -> fmap (\a -> (a, s, mempty)) m-  + instance (Semigroup w, Monoid w) => BindTrans (Strict.RWST r w s) where   liftB m = Strict.RWST $ \ _r s -> fmap (\a -> (a, s, mempty)) m 
src/Data/Functor/Extend.hs view
@@ -120,21 +120,17 @@ -- $definition -- There are two ways to define an 'Extend' instance: ----- I. Provide definitions for 'extend'+-- I. Provide definitions for 'extended' -- satisfying this law: -- -- > extended f . extended g = extended (f . extended g) ----- II. Alternately, you may choose to provide definitions for 'duplicate'+-- II. Alternately, you may choose to provide definitions for 'duplicated' -- 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'.+-- You may of course, choose to define both 'duplicated' /and/ 'extended'. -- In that case you must also satisfy these laws: -- -- > extended f = fmap f . duplicated
src/Data/Functor/Plus.hs view
@@ -46,14 +46,14 @@ import Prelude hiding (id, (.))  -- | Laws:--- +-- -- > zero <!> m = m -- > m <!> zero = m -- -- If extended to an 'Alternative' then 'zero' should equal 'empty'.  class Alt f => Plus f where-  zero :: f a +  zero :: f a  instance Plus IO where   zero = error "zero"@@ -93,7 +93,7 @@  instance (Bind f, Monad f) => Plus (MaybeT f) where   zero = MaybeT $ return zero-  + instance (Bind f, Monad f, Error e) => Plus (ErrorT e f) where   zero = ErrorT $ return $ Left noMsg @@ -102,18 +102,18 @@  instance (Plus f) => Plus (Strict.StateT e f) where   zero = Strict.StateT $ \_ -> zero-  + instance (Plus f) => Plus (Lazy.StateT e f) where   zero = Lazy.StateT $ \_ -> zero  instance Plus f => Plus (Strict.WriterT w f) where   zero = Strict.WriterT zero-  + instance Plus f => Plus (Lazy.WriterT w f) where   zero = Lazy.WriterT zero-  + instance Plus f => Plus (Strict.RWST r w s f) where-  zero = Strict.RWST $ \_ _ -> zero +  zero = Strict.RWST $ \_ _ -> zero  instance Plus f => Plus (Lazy.RWST r w s f) where   zero = Lazy.RWST $ \_ _ -> zero
src/Data/Semifunctor.hs view
@@ -90,9 +90,9 @@ sndP (Bi (_,b)) = b  left :: a -> Bi Either (a,b)-left = Bi . Left +left = Bi . Left -right :: b -> Bi Either (a,b) +right :: b -> Bi Either (a,b) right = Bi . Right  instance Semifunctor (Bi (,)) (Product (->) (->)) (->) where
src/Data/Semigroup/Foldable.hs view
@@ -34,7 +34,7 @@   fold1 :: Semigroup m => t m -> m   foldMap1 :: Semigroup m => (a -> m) -> t a -> m -  foldMap1 f = maybe (error "foldMap1") id . getOption . foldMap (Option . Just . f) +  foldMap1 f = maybe (error "foldMap1") id . getOption . foldMap (Option . Just . f)   fold1 = foldMap1 id  instance Foldable1 Tree where
src/Data/Semigroupoid/Coproduct.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE GADTs, EmptyDataDecls #-}-module Data.Semigroupoid.Coproduct +module Data.Semigroupoid.Coproduct   ( L, R, Coproduct(..), distributeDualCoproduct, factorDualCoproduct) where  import Data.Semigroupoid
src/Data/Semigroupoid/Product.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE GADTs #-}-module Data.Semigroupoid.Product +module Data.Semigroupoid.Product   ( Product(..)   , distributeDualProduct   , factorDualProduct
src/Data/Semigroupoid/Static.hs view
@@ -15,7 +15,9 @@ import Control.Applicative import Control.Category import Control.Comonad+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707 import Control.Monad.Instances ()+#endif import Control.Monad (ap) import Data.Functor.Apply import Data.Functor.Plus