TypeCompose 0.7.0 → 0.8.0
raw patch · 2 files changed
+25/−5 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Compose: instance Show (g (f a)) => Show ((:.) g f a)
+ Control.Compose: instance Show a => Show (Id a)
- Control.Compose: O :: g (f a) -> :. g f a
+ Control.Compose: O :: (g (f a)) -> :. g f a
- Control.Compose: unO :: :. g f a -> g (f a)
+ Control.Compose: unO :: (g :. f) a -> g (f a)
Files
- TypeCompose.cabal +1/−1
- src/Control/Compose.hs +24/−4
TypeCompose.cabal view
@@ -1,5 +1,5 @@ Name: TypeCompose-Version: 0.7.0+Version: 0.8.0 Synopsis: Type composition classes & instances Category: Composition, Control Description:
src/Control/Compose.hs view
@@ -33,7 +33,7 @@ -- * Contravariant functors , Cofunctor(..), bicomap -- * Unary\/unary composition- , (:.)(..), O, biO, convO, coconvO, inO, inO2, inO3+ , (:.)(..), O, unO, biO, convO, coconvO, inO, inO2, inO3 , oPure, oFmap, oLiftA2, oLiftA3 , fmapFF, fmapCC, cofmapFC, cofmapCF -- , DistribM(..), joinMM@@ -51,7 +51,7 @@ -- * Type application , (:$)(..), App, biApp, inApp, inApp2 -- * Identity- , Id(..), biId, inId, inId2+ , Id(..),unId, biId, inId, inId2 -- * Constructor pairing -- ** Unary , (:*:)(..), biProd, convProd, (***#), ($*), inProd, inProd2, inProd3@@ -187,8 +187,14 @@ constraints, rather than just matching instance heads. -}-newtype (g :. f) a = O { unO :: g (f a) }+newtype (g :. f) a = O (g (f a)) deriving Show +-- newtype (g :. f) a = O { unO :: g (f a) } deriving Show++-- | Unwrap a '(:.)'.+unO :: (g :. f) a -> g (f a)+unO (O gfa) = gfa+ -- | Compatibility synonym type O = (:.) @@ -196,6 +202,10 @@ instance (Functor g, Functor f) => Functor (g :. f) where fmap = fmapFF +-- or+-- +-- deriving instance (Functor g, Functor f) => Functor (g :. f)+ -- These next two instances are based on suggestions from Creighton Hogg: instance (Foldable g, Foldable f, Functor g) => Foldable (g :. f) where@@ -577,7 +587,17 @@ -- | Identity type constructor. Until there's a better place to find it. -- I'd use "Control.Monad.Identity", but I don't want to introduce a -- dependency on mtl just for Id.-newtype Id a = Id { unId :: a }+newtype Id a = Id a deriving Show++-- Could define record field:+-- +-- newtype Id a = Id { unId :: a } deriving Show+-- +-- but then Show is uglier.++-- Extract value from an 'Id'+unId :: Id a -> a+unId (Id a) = a inId :: (a -> b) -> (Id a -> Id b) inId = unId ~> Id