barbies 2.0.4.0 → 2.0.5.0
raw patch · 4 files changed
+17/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Barbies.Constraints: class (c a, d a) => ( c & d ) a
Files
- ChangeLog.md +3/−0
- barbies.cabal +1/−1
- src/Barbies/Constraints.hs +3/−0
- src/Barbies/Internal/ConstraintsB.hs +10/−0
ChangeLog.md view
@@ -1,5 +1,8 @@ # Changelog for barbies +## 2.0.5.0+ - Add helper class Barbies.Constraints.(&) (#46)+ ## 2.0.4.0 - Add FunctorT and DistributiveT instances for AccumT
barbies.cabal view
@@ -1,5 +1,5 @@ name: barbies-version: 2.0.4.0+version: 2.0.5.0 synopsis: Classes for working with types that can change clothes. description: Types that are parametric on a functor are like Barbies that have an outfit for each role. This package provides the basic abstractions to work with them comfortably. category: Data Structures
src/Barbies/Constraints.hs view
@@ -13,6 +13,9 @@ , AllBF , ClassF , ClassFG++ -- * Helpers+ , type (&) ) where
src/Barbies/Internal/ConstraintsB.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE UndecidableSuperClasses #-} {-# OPTIONS_GHC -Wno-orphans #-} module Barbies.Internal.ConstraintsB ( ConstraintsB(..)@@ -16,6 +17,8 @@ , bzipWith4C , bfoldMapC + , type (&)+ , CanDeriveConstraintsB , gbaddDictsDefault , GAllRepB@@ -105,6 +108,8 @@ => b f -> b (Dict c `Product` f) baddDicts = gbaddDictsDefault +class (c a, d a) => (c & d) a where+instance (c a, d a) => (c & d) a where -- | Like 'bmap' but a constraint is allowed to be required on -- each element of @b@@@ -117,6 +122,11 @@ -- > where -- > showField :: forall a. Show a => Identity a -> Const String a -- > showField (Identity a) = Const (show a)+--+-- Notice that one can use the '(&)' class as a way to require several+-- constraiints to hold simultaneously:+--+-- > bmap @(Show & Eq & Enum) r bmapC :: forall c b f g . (AllB c b, ConstraintsB b) => (forall a. c a => f a -> g a)