categories 1.0.2 → 1.0.3
raw patch · 4 files changed
+38/−10 lines, 4 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Control.Categorical.Bifunctor: class (Category r, Category t) => PFunctor p r t | p r -> t, p t -> r where first f = bimap f id
+ Control.Categorical.Bifunctor: class (Category r, Category t) => PFunctor p r t | p r -> t, p t -> r
- Control.Categorical.Bifunctor: class (Category s, Category t) => QFunctor q s t | q s -> t, q t -> s where second = bimap id
+ Control.Categorical.Bifunctor: class (Category s, Category t) => QFunctor q s t | q s -> t, q t -> s
Files
- Control/Categorical/Bifunctor.hs +9/−9
- Control/Categorical/Functor.hs +16/−0
- Control/Category/Dual.hs +12/−0
- categories.cabal +1/−1
Control/Categorical/Bifunctor.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, DefaultSignatures #-}+{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts #-} ------------------------------------------------------------------------------------------- -- | -- Module : Control.Categorical.Bifunctor@@ -25,13 +25,13 @@ class (Category r, Category t) => PFunctor p r t | p r -> t, p t -> r where first :: r a b -> t (p a c) (p b c)- default first :: Bifunctor p r s t => r a b -> t (p a c) (p b c)- first f = bimap f id+-- default first :: Bifunctor p r s t => r a b -> t (p a c) (p b c)+-- first f = bimap f id class (Category s, Category t) => QFunctor q s t | q s -> t, q t -> s where second :: s a b -> t (q c a) (q c b)- default second :: Bifunctor q r s t => s a b -> t (q c a) (q c b)- second = bimap id+-- default second :: Bifunctor q r s t => s a b -> t (q c a) (q c b)+-- second = bimap id -- | Minimal definition: @bimap@ @@ -40,13 +40,13 @@ bimap :: r a b -> s c d -> t (p a c) (p b d) -- bimap f g = second g . first f -instance PFunctor (,) (->) (->)-instance QFunctor (,) (->) (->)+instance PFunctor (,) (->) (->) where first f = bimap f id+instance QFunctor (,) (->) (->) where second = bimap id instance Bifunctor (,) (->) (->) (->) where bimap f g (a,b)= (f a, g b) -instance PFunctor Either (->) (->)-instance QFunctor Either (->) (->)+instance PFunctor Either (->) (->) where first f = bimap f id+instance QFunctor Either (->) (->) where second = bimap id instance Bifunctor Either (->) (->) (->) where bimap f _ (Left a) = Left (f a) bimap _ g (Right a) = Right (g a)
Control/Categorical/Functor.hs view
@@ -18,13 +18,21 @@ , LoweredFunctor(..) ) where +#ifndef MIN_VERSION_base+#define MIN_VERSION_base(x,y,z) 1+#endif+ import Control.Category import Prelude hiding (id, (.), Functor(..)) import qualified Prelude #ifdef __GLASGOW_HASKELL__ import Data.Data (Data(..), mkDataType, DataType, mkConstr, Constr, constrIndex, Fixity(..))+#if MIN_VERSION_base(4,4,0) import Data.Typeable (Typeable1(..), TyCon, mkTyCon3, mkTyConApp, gcast1)+#else+import Data.Typeable (Typeable1(..), TyCon, mkTyCon, mkTyConApp, gcast1) #endif+#endif -- TODO Data, Typeable newtype LiftedFunctor f a = LiftedFunctor (f a) deriving (Show, Read)@@ -32,7 +40,11 @@ #ifdef __GLASGOW_HASKELL__ liftedTyCon :: TyCon+#if MIN_VERSION_base(4,4,0) liftedTyCon = mkTyCon3 "categories" "Control.Categorical.Functor" "LiftedFunctor"+#else+liftedTyCon = mkTyCon "Control.Categorical.Functor.LiftedFunctor"+#endif {-# NOINLINE liftedTyCon #-} liftedConstr :: Constr@@ -63,7 +75,11 @@ #ifdef __GLASGOW_HASKELL__ loweredTyCon :: TyCon+#if MIN_VERSION_base(4,4,0) loweredTyCon = mkTyCon3 "categories" "Control.Categorical.Functor" "LoweredFunctor"+#else+loweredTyCon = mkTyCon "Control.Categorical.Functor.LoweredFunctor"+#endif {-# NOINLINE loweredTyCon #-} loweredConstr :: Constr
Control/Category/Dual.hs view
@@ -14,13 +14,21 @@ ( Dual(..) ) where +#ifndef MIN_VERSION_base+#define MIN_VERSION_base(x,y,z) 1+#endif+ import Prelude (undefined,const,error) import Control.Category #ifdef __GLASGOW_HASKELL__ import Data.Data (Data(..), mkDataType, DataType, mkConstr, Constr, constrIndex, Fixity(..))+#if MIN_VERSION_base(4,4,0) import Data.Typeable (Typeable2(..), TyCon, mkTyCon3, mkTyConApp, gcast1)+#else+import Data.Typeable (Typeable2(..), TyCon, mkTyCon, mkTyConApp, gcast1) #endif+#endif data Dual k a b = Dual { runDual :: k b a } @@ -35,7 +43,11 @@ asDualArgsType = const dataTyCon :: TyCon+#if MIN_VERSION_base(4,4,0) dataTyCon = mkTyCon3 "categories" "Control.Category.Dual" "Dual"+#else+dataTyCon = mkTyCon "Control.Category.Dual.Dual"+#endif {-# NOINLINE dataTyCon #-} dualConstr :: Constr
categories.cabal view
@@ -1,6 +1,6 @@ name: categories category: Control-version: 1.0.2+version: 1.0.3 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE