categories 0.58.0.1 → 0.58.0.3
raw patch · 4 files changed
+43/−15 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Categorical.Functor: instance (Typeable1 f, Data (f a), Data a) => Data (LiftedFunctor f a)
- Control.Categorical.Functor: instance (Typeable1 f, Data (f a), Data a) => Data (LoweredFunctor f a)
- Control.Categorical.Functor: instance Typeable1 f => Typeable1 (LiftedFunctor f)
- Control.Categorical.Functor: instance Typeable1 f => Typeable1 (LoweredFunctor f)
- Control.Category.Dual: instance (Typeable2 (~>), Data a, Data b, Data ((~>) b a)) => Data (Dual (~>) a b)
- Control.Category.Dual: instance Typeable2 (~>) => Typeable2 (Dual (~>))
Files
- Control/Categorical/Functor.hs +15/−7
- Control/Category/Discrete.hs +3/−0
- Control/Category/Dual.hs +10/−5
- categories.cabal +15/−3
Control/Categorical/Functor.hs view
@@ -1,13 +1,13 @@-{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, DeriveDataTypeable, FlexibleContexts, UndecidableInstances, FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, UndecidableInstances, FlexibleInstances #-} ------------------------------------------------------------------------------------------- -- |--- Module : Control.Categorical.Functor--- Copyright : 2008-2010 Edward Kmett+-- Module : Control.Categorical.Functor+-- Copyright : 2008-2010 Edward Kmett -- License : BSD3 ----- Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (functional-dependencies)+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : experimental+-- Portability : non-portable (functional-dependencies) -- -- A more categorical definition of 'Functor' -------------------------------------------------------------------------------------------@@ -21,13 +21,17 @@ import Control.Category import Prelude hiding (id, (.), Functor(..)) import qualified Prelude+#ifdef GLASGOW_HASKELL import Data.Data (Data(..), mkDataType, DataType, mkConstr, Constr, constrIndex, Fixity(..)) import Data.Typeable (Typeable1(..), TyCon, mkTyCon, mkTyConApp, gcast1)+#endif -- TODO Data, Typeable newtype LiftedFunctor f a = LiftedFunctor (f a) deriving (Show, Read) +#ifdef GLASGOW_HASKELL+ liftedTyCon :: TyCon liftedTyCon = mkTyCon "Control.Categorical.Functor.LiftedFunctor" {-# NOINLINE liftedTyCon #-}@@ -53,10 +57,13 @@ _ -> error "gunfold" dataTypeOf _ = liftedDataType dataCast1 f = gcast1 f+#endif newtype LoweredFunctor f a = LoweredFunctor (f a) deriving (Show, Read) +#ifdef GLASGOW_HASKELL+ loweredTyCon :: TyCon loweredTyCon = mkTyCon "Control.Categorical.Functor.LoweredFunctor" {-# NOINLINE loweredTyCon #-}@@ -83,6 +90,8 @@ dataTypeOf _ = loweredDataType dataCast1 f = gcast1 f +#endif+ class (Category r, Category t) => Functor f r t | f r -> t, f t -> r where fmap :: r a b -> t (f a) (f b) @@ -110,4 +119,3 @@ class (Functor f (~>) (~>)) => EndoFunctor f (~>) instance (Functor f (~>) (~>)) => EndoFunctor f (~>)-
Control/Category/Discrete.hs view
@@ -29,6 +29,9 @@ id = Refl Refl . Refl = Refl +-- instance Groupoid Discrete where+-- inv Refl = Refl+ -- | Discrete a b acts as a proof that a = b, lift that proof into something of kind * -> * liftDiscrete :: Discrete a b -> Discrete (f a) (f b) liftDiscrete Refl = Refl
Control/Category/Dual.hs view
@@ -1,9 +1,9 @@-{-# LANGUAGE DeriveDataTypeable, TypeOperators, FlexibleContexts #-}+{-# LANGUAGE TypeOperators, FlexibleContexts #-} ------------------------------------------------------------------------------------------- -- |--- Module : Control.Category.Dual--- Copyright : 2008-2010 Edward Kmett--- License : BSD+-- Module : Control.Category.Dual+-- Copyright : 2008-2010 Edward Kmett+-- License : BSD -- -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : experimental@@ -14,10 +14,13 @@ ( Dual(..) ) where -import Prelude hiding ((.), id)+import Prelude () import Control.Category++#ifdef GLASGOW_HASKELL import Data.Data (Data(..), mkDataType, DataType, mkConstr, Constr, constrIndex, Fixity(..)) import Data.Typeable (Typeable2(..), TyCon, mkTyCon, mkTyConApp, gcast1)+#endif data Dual k a b = Dual { runDual :: k b a } @@ -25,6 +28,7 @@ id = Dual id Dual f . Dual g = Dual (g . f) +#ifdef GLASGOW_HASKELL instance Typeable2 (~>) => Typeable2 (Dual (~>)) where typeOf2 tfab = mkTyConApp dataTyCon [typeOf2 (undefined `asDualArgsType` tfab)] where asDualArgsType :: f b a -> t f a b -> f b a@@ -50,3 +54,4 @@ _ -> error "gunfold" dataTypeOf _ = dataDataType dataCast1 f = gcast1 f+#endif
categories.cabal view
@@ -1,8 +1,8 @@ name: categories category: Control-version: 0.58.0.1+version: 0.58.0.3 license: BSD3-cabal-version: >= 1.2+cabal-version: >= 1.2.3 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett <ekmett@gmail.com>@@ -18,6 +18,17 @@ default: False library+ extensions: CPP + other-extensions:+ MultiParamTypeClasses+ FunctionalDependencies+ FlexibleContexts+ FlexibleInstances+ UndecidableInstances+ TypeOperators+ TypeFamilies+ GADTs+ exposed-modules: Control.Categorical.Functor, Control.Categorical.Bifunctor,@@ -34,7 +45,8 @@ build-depends: base >= 4 && < 5, void >= 0.5.1 && < 0.6- + ghc-options: -Wall + if flag(Optimize) ghc-options: -funbox-strict-fields -O2