free 3.4 → 3.4.1
raw patch · 9 files changed
+60/−12 lines, 9 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.markdown +4/−0
- free.cabal +1/−1
- src/Control/Alternative/Free.hs +7/−1
- src/Control/Applicative/Free.hs +7/−1
- src/Control/Comonad/Cofree.hs +7/−1
- src/Control/Comonad/Trans/Cofree.hs +11/−3
- src/Control/Monad/Free.hs +7/−1
- src/Control/Monad/Trans/Free.hs +9/−3
- src/Control/MonadPlus/Free.hs +7/−1
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+3.4.1+-----+* Added support for GHC 7.7's polykinded `Typeable`+ 3.4 --- * Added instance `MonadFree f (ContT r m)`
free.cabal view
@@ -1,6 +1,6 @@ name: free category: Control, Monads-version: 3.4+version: 3.4.1 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE
src/Control/Alternative/Free.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE GADTs #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#endif {-# OPTIONS_GHC -Wall #-} ----------------------------------------------------------------------------- -- |@@ -35,6 +38,9 @@ Pure :: a -> Alt f a Ap :: f a -> Alt f (a -> b) -> Alt f b Alt :: [Alt f a] -> Alt f a+#if __GLASGOW_HASKELL__ >= 707+ deriving (Typeable)+#endif -- | Given a natural transformation from @f@ to @g@, this gives a canonical monoidal natural transformation from @'Alt' f@ to @g@. runAlt :: Alternative g => (forall x. f x -> g x) -> Alt f a -> g a@@ -95,7 +101,7 @@ hoistAlt f (Ap x y) = Ap (f x) (hoistAlt f y) hoistAlt f (Alt as) = Alt (map (hoistAlt f) as) -#ifdef GHC_TYPEABLE+#if defined(GHC_TYPEABLE) && __GLASGOW_HASKELL__ < 707 instance Typeable1 f => Typeable1 (Alt f) where typeOf1 t = mkTyConApp altTyCon [typeOf1 (f t)] where f :: Alt f a -> f a
src/Control/Applicative/Free.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE GADTs #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#endif {-# OPTIONS_GHC -Wall #-} ----------------------------------------------------------------------------- -- |@@ -32,6 +35,9 @@ data Ap f a where Pure :: a -> Ap f a Ap :: f a -> Ap f (a -> b) -> Ap f b+#if __GLASGOW_HASKELL__ >= 707+ deriving (Typeable)+#endif -- | Given a natural transformation from @f@ to @g@, this gives a canonical monoidal natural transformation from @'Ap' f@ to @g@. runAp :: Applicative g => (forall x. f x -> g x) -> Ap f a -> g a@@ -61,7 +67,7 @@ hoistAp _ (Pure a) = Pure a hoistAp f (Ap x y) = Ap (f x) (hoistAp f y) -#ifdef GHC_TYPEABLE+#if defined(GHC_TYPEABLE) && __GLASGOW_HASKELL__ < 707 instance Typeable1 f => Typeable1 (Ap f) where typeOf1 t = mkTyConApp apTyCon [typeOf1 (f t)] where f :: Ap f a -> f a
src/Control/Comonad/Cofree.hs view
@@ -3,6 +3,9 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Cofree@@ -83,6 +86,9 @@ -- * @'Cofree' ((->) b)'@ describes a Moore machine with states labeled with values of type a, and transitions on edges of type b. -- data Cofree f a = a :< f (Cofree f a)+#if __GLASGOW_HASKELL__ >= 707+ deriving (Typeable)+#endif -- | Use coiteration to generate a cofree comonad from a seed. --@@ -200,7 +206,7 @@ go (a :< as) = (:<) <$> f a <.> traverse1 go as {-# INLINE traverse1 #-} -#ifdef GHC_TYPEABLE+#if defined(GHC_TYPEABLE) && __GLASGOW_HASKELL__ < 707 instance (Typeable1 f) => Typeable1 (Cofree f) where typeOf1 dfa = mkTyConApp cofreeTyCon [typeOf1 (f dfa)] where
src/Control/Comonad/Trans/Cofree.hs view
@@ -3,6 +3,10 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#endif+ ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Trans.Cofree@@ -36,7 +40,7 @@ import Data.Traversable import Prelude hiding (id,(.)) -#ifdef GHC_TYPEABLE+#if defined(GHC_TYPEABLE) || __GLASGOW_HASKELL__ >= 707 import Data.Data #endif @@ -44,7 +48,11 @@ -- | This is the base functor of the cofree comonad transformer. data CofreeF f a b = a :< f b- deriving (Eq,Ord,Show,Read)+ deriving (Eq,Ord,Show,Read+#if __GLASGOW_HASKELL__ >= 707+ ,Typeable+#endif+ ) -- | Extract the head of the base functor headF :: CofreeF f a b -> a@@ -108,7 +116,7 @@ instance Ord (w (CofreeF f a (CofreeT f w a))) => Ord (CofreeT f w a) where compare (CofreeT a) (CofreeT b) = compare a b -#ifdef GHC_TYPEABLE+#if defined(GHC_TYPEABLE) && __GLASGOW_HASKELL__ < 707 instance Typeable1 f => Typeable2 (CofreeF f) where typeOf2 t = mkTyConApp cofreeFTyCon [typeOf1 (f t)] where
src/Control/Monad/Free.hs view
@@ -4,6 +4,9 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Free@@ -89,6 +92,9 @@ -- -- * @'Free' 'Maybe'@ can be used to model a partiality monad where each layer represents running the computation for a while longer. data Free f a = Pure a | Free (f (Free f a))+#if __GLASGOW_HASKELL__ >= 707+ deriving (Typeable)+#endif instance (Eq (f (Free f a)), Eq a) => Eq (Free f a) where Pure a == Pure b = a == b@@ -248,7 +254,7 @@ hoistFree _ (Pure a) = Pure a hoistFree f (Free as) = Free (hoistFree f <$> f as) -#ifdef GHC_TYPEABLE+#if defined(GHC_TYPEABLE) && __GLASGOW_HASKELL__ < 707 instance Typeable1 f => Typeable1 (Free f) where typeOf1 t = mkTyConApp freeTyCon [typeOf1 (f t)] where f :: Free f a -> f a
src/Control/Monad/Trans/Free.hs view
@@ -4,6 +4,9 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Free@@ -43,7 +46,11 @@ -- | The base functor for a free monad. data FreeF f a b = Pure a | Free (f b)- deriving (Eq,Ord,Show,Read)+ deriving (Eq,Ord,Show,Read+#if __GLASGOW_HASKELL__ >= 707+ ,Typeable+#endif+ ) instance Functor f => Functor (FreeF f a) where fmap _ (Pure a) = Pure a@@ -155,8 +162,7 @@ transFreeT :: (Monad m, Functor g) => (forall a. f a -> g a) -> FreeT f m b -> FreeT g m b transFreeT nt = FreeT . liftM (fmap (transFreeT nt) . transFreeF nt) . runFreeT -#ifdef GHC_TYPEABLE-+#if defined(GHC_TYPEABLE) && __GLASGOW_HASKELL__ < 707 instance Typeable1 f => Typeable2 (FreeF f) where typeOf2 t = mkTyConApp freeFTyCon [typeOf1 (f t)] where f :: FreeF f a b -> f a
src/Control/MonadPlus/Free.hs view
@@ -4,6 +4,9 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE DeriveDataTypeable #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Control.MonadPlus.Free@@ -58,6 +61,9 @@ = Pure a | Free (f (Free f a)) | Plus [Free f a]+#if __GLASGOW_HASKELL__ >= 707+ deriving (Typeable)+#endif instance (Eq (f (Free f a)), Eq a) => Eq (Free f a) where Pure a == Pure b = a == b@@ -250,7 +256,7 @@ go (Free as) = Free (go <$> f as) go (Plus as) = Plus (map go as) -#ifdef GHC_TYPEABLE+#if defined(GHC_TYPEABLE) && __GLASGOW_HASKELL__ < 707 instance Typeable1 f => Typeable1 (Free f) where typeOf1 t = mkTyConApp freeTyCon [typeOf1 (f t)] where f :: Free f a -> f a