packages feed

barbies 1.0.0.0 → 1.1.0.0

raw patch · 14 files changed

+239/−47 lines, 14 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Barbie: --
+ Data.Barbie: -- </pre>
+ Data.Barbie: -- <a>AllB</a> <a>Show</a> Barbie ~ (<a>Show</a> <a>String</a>, <a>Show</a> <a>Int</a>)
+ Data.Barbie: -- <a>AllBF</a>.
+ Data.Barbie: -- <pre>
+ Data.Barbie: -- For requiring constraints of the form <tt>c (f a)</tt>, use
+ Data.Barbie: -- each <tt>a</tt> occurring under an <tt>f</tt> in <tt>b f</tt>. E.g.:
+ Data.Barbie: -- | <tt><a>AllB</a> c b</tt> should contain a constraint <tt>c a</tt> for
+ Data.Barbie.Bare: type family Wear t f a
+ Data.Barbie.Constraints: --
+ Data.Barbie.Constraints: -- </pre>
+ Data.Barbie.Constraints: -- <a>AllB</a> <a>Show</a> Barbie ~ (<a>Show</a> <a>String</a>, <a>Show</a> <a>Int</a>)
+ Data.Barbie.Constraints: -- <a>AllBF</a>.
+ Data.Barbie.Constraints: -- <pre>
+ Data.Barbie.Constraints: -- For requiring constraints of the form <tt>c (f a)</tt>, use
+ Data.Barbie.Constraints: -- each <tt>a</tt> occurring under an <tt>f</tt> in <tt>b f</tt>. E.g.:
+ Data.Barbie.Constraints: -- | <tt><a>AllB</a> c b</tt> should contain a constraint <tt>c a</tt> for
+ Data.Functor.Prod: type family Curried t
- Data.Barbie: Barbie :: b f -> Barbie b
+ Data.Barbie: Barbie :: b f -> Barbie f
- Data.Barbie: [getBarbie] :: Barbie b -> b f
+ Data.Barbie: [getBarbie] :: Barbie f -> b f
- Data.Barbie: class FunctorB b => ConstraintsB b where {
+ Data.Barbie: class FunctorB b => ConstraintsB (b :: (k -> *) -> *) where {
- Data.Barbie: class FunctorB b
+ Data.Barbie: class FunctorB (b :: (k -> Type) -> Type)
- Data.Barbie: class FunctorB b => ProductB b
+ Data.Barbie: class FunctorB b => ProductB (b :: (k -> Type) -> Type)
- Data.Barbie: class (ConstraintsB b, ProductB b) => ProductBC b
+ Data.Barbie: class (ConstraintsB b, ProductB b) => ProductBC (b :: (k -> Type) -> Type)
- Data.Barbie: class FunctorB b => TraversableB b
+ Data.Barbie: class FunctorB b => TraversableB (b :: (k -> Type) -> Type)
- Data.Barbie: data Unit (f :: * -> *)
+ Data.Barbie: data Unit (f :: k -> Type)
- Data.Barbie: data Void (f :: * -> *)
+ Data.Barbie: data Void (f :: k -> Type)
- Data.Barbie: newtype Barbie b (f :: * -> *)
+ Data.Barbie: newtype Barbie (b :: (k -> Type) -> Type) f
- Data.Barbie: type family AllB (c :: * -> Constraint) b :: Constraint;
+ Data.Barbie: type family AllB (c :: k -> Constraint) b :: Constraint;
- Data.Barbie.Constraints: class FunctorB b => ConstraintsB b where {
+ Data.Barbie.Constraints: class FunctorB b => ConstraintsB (b :: (k -> *) -> *) where {
- Data.Barbie.Constraints: class (ConstraintsB b, ProductB b) => ProductBC b
+ Data.Barbie.Constraints: class (ConstraintsB b, ProductB b) => ProductBC (b :: (k -> Type) -> Type)
- Data.Barbie.Constraints: requiringDict :: (c a => r) -> (Dict c a -> r)
+ Data.Barbie.Constraints: requiringDict :: (c a => r) -> Dict c a -> r
- Data.Barbie.Constraints: type family AllB (c :: * -> Constraint) b :: Constraint;
+ Data.Barbie.Constraints: type family AllB (c :: k -> Constraint) b :: Constraint;
- Data.Barbie.Internal: class GAllBC repbx => GConstraintsB c (f :: * -> *) repbx repbf repbdf
+ Data.Barbie.Internal: class GAllBC repbx => GConstraintsB c (f :: k -> *) repbx repbf repbdf
- Data.Barbie.Internal: class GProductB (f :: * -> *) (g :: * -> *) repbf repbg repbfg
+ Data.Barbie.Internal: class GProductB (f :: k -> *) (g :: k -> *) repbf repbg repbfg
- Data.Barbie.Internal: data Other (b :: (* -> *) -> *) (f :: * -> *)
+ Data.Barbie.Internal: data Other (b :: (k -> *) -> *) (f :: k -> *)
- Data.Barbie.Internal: data Self (b :: (* -> *) -> *) (f :: * -> *)
+ Data.Barbie.Internal: data Self (b :: (k -> *) -> *) (f :: k -> *)
- Data.Barbie.Internal: type family GAllB (c :: * -> Constraint) repbf :: Constraint;
+ Data.Barbie.Internal: type family RepN (a :: Type) :: Type -> Type
- Data.Functor.Prod: [Cons] :: (f a) -> Prod fs a -> Prod (f : fs) a
+ Data.Functor.Prod: [Cons] :: f a -> Prod fs a -> Prod (f : fs) a
- Data.Functor.Prod: data Prod :: [* -> *] -> * -> *
+ Data.Functor.Prod: data Prod :: [k -> Type] -> k -> Type

Files

ChangeLog.md view
@@ -1,5 +1,13 @@ # Changelog for barbies +## 1.1.0.0+  - Make all classes poly-kinded (#7): a barbie can now be any type +    parameterised by a type `(k -> Type)`. In particular, a (higher-kinded)+    barbie is a type parameterised by a barbie. Thanks to Ole Krüger.++  - Add instances for functor transformers: `Proxy`, `Const`, `Product`, `Sum`+    and `Compose` (Ole Krüger).+ ## 1.0.0.0   - Replaced `ConstraintsOf` in `ConstraintsB` by `AllB`, which allows     constraints to be given on `a` instead of on `f a`. The `ClassF`
barbies.cabal view
@@ -1,5 +1,5 @@ name:           barbies-version:        1.0.0.0+version:        1.1.0.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/Data/Barbie.hs view
@@ -2,7 +2,7 @@ -- | -- Module      :  Data.Barbie ----- A common Haskell idiom is to parameterise a datatype by a type @* -> *@,+-- A common Haskell idiom is to parameterise a datatype by a type @k -> *@, -- typically a functor or a GADT. These are like outfits of a Barbie, -- that turn her into a different doll. E.g. --@@ -41,6 +41,20 @@ -- and it may feel like a second-class record type, where one needs to -- unpack values in each field. "Data.Barbie.Bare" offers a way to have -- bare versions of a barbie-type.+--+-- Notice that all classes in this package are poly-kinded. Intuitively,+-- a barbie is a type parameterised by a functor, and because a barbies is+-- a type of functor, a type parameterised by a barbie is a (higher-kinded)+-- barbie too:+--+-- @+-- data Catalog b+--   = Catalog (b 'Identity') (b 'Maybe')+--   deriving+--     ('GHC.Generics.Generic'+--     , 'FunctorB', 'TraversableB', 'ProductB', 'ConstraintsB', 'ProductBC'+--     )+-- @   ----------------------------------------------------------------------------
src/Data/Barbie/Internal/Constraints.hs view
@@ -1,6 +1,7 @@-{-# LANGUAGE AllowAmbiguousTypes   #-}-{-# LANGUAGE TypeFamilies          #-}-{-# LANGUAGE UndecidableInstances  #-}+{-# LANGUAGE AllowAmbiguousTypes  #-}+{-# LANGUAGE TypeFamilies         #-}+{-# LANGUAGE PolyKinds            #-}+{-# LANGUAGE UndecidableInstances #-} module Data.Barbie.Internal.Constraints   ( ConstraintsB(..)   , AllBF@@ -19,11 +20,15 @@  where -import Data.Barbie.Internal.Dicts(ClassF, Dict(..))-import Data.Barbie.Internal.Functor(FunctorB(..))+import Data.Barbie.Internal.Dicts   (ClassF, Dict (..))+import Data.Barbie.Internal.Functor (FunctorB (..)) -import Data.Functor.Product(Product(..))-import Data.Kind(Constraint)+import Data.Functor.Compose (Compose (..))+import Data.Functor.Const   (Const (..))+import Data.Functor.Product (Product (..))+import Data.Functor.Sum     (Sum (..))+import Data.Kind            (Constraint)+import Data.Proxy           (Proxy (..))  import Data.Generics.GenericN @@ -59,7 +64,7 @@ -- derive instance 'Generic' (T f) -- instance 'ConstraintsB' T -- @-class FunctorB b => ConstraintsB b where+class FunctorB b => ConstraintsB (b :: (k -> *) -> *) where   -- | @'AllB' c b@ should contain a constraint @c a@ for each   --   @a@ occurring under an @f@ in @b f@. E.g.:   --@@ -68,7 +73,7 @@   -- @   --   -- For requiring constraints of the form @c (f a)@, use 'AllBF'.-  type AllB (c :: * -> Constraint) b :: Constraint+  type AllB (c :: k -> Constraint) b :: Constraint   type AllB c b = GAllB c (GAllBRep b)    baddDicts :: forall c f.  AllB c b => b f -> b (Dict c `Product` f)@@ -138,9 +143,9 @@ {-# INLINE gbaddDictsDefault #-}  class GAllBC (repbf :: * -> *) where-  type GAllB (c :: * -> Constraint) repbf :: Constraint+  type GAllB (c :: k -> Constraint) repbf :: Constraint -class GAllBC repbx => GConstraintsB c (f :: * -> *) repbx repbf repbdf where+class GAllBC repbx => GConstraintsB c (f :: k -> *) repbx repbf repbdf where   gbaddDicts :: GAllB c repbx => repbf x -> repbdf x  @@ -275,8 +280,8 @@ -- -- ============================================================================ -data Self  (b :: (* -> *) -> *) (f :: * -> *)-data Other (b :: (* -> *) -> *) (f :: * -> *)+data Self  (b :: (k -> *) -> *) (f :: k -> *)+data Other (b :: (k -> *) -> *) (f :: k -> *)  -- | We use type-families to generically compute @'AllB' c b@. Intuitively, if --   @b' f@ occurs inside @b f@, then we should just add @AllB b' c@ to@@ -288,7 +293,7 @@ --   family to inspect @RepN (b f)@ and distinguish recursive usages from --   non-recursive ones, tagging them with different types, so we can distinguish --   them in the instances.-type family TagSelf (b :: (* -> *) -> *) (repbf :: * -> *) :: * -> * where+type family TagSelf (b :: (k -> *) -> *) (repbf :: * -> *) :: * -> * where   TagSelf b (M1 mt m s)     = M1 mt m (TagSelf b s) @@ -301,7 +306,7 @@   TagSelf b (Rec (b f) (b g))     = Rec (Self b f) (b g) -  TagSelf b (Rec (b' f) (b'' (g :: * -> *)))+  TagSelf (b :: (k -> *) -> *) (Rec (b' f) ((b'' :: (k -> *) -> *) g))     = Rec (Other b' f) (b'' g)    TagSelf b (Rec p a)@@ -312,3 +317,40 @@    TagSelf b V1     = V1+++-- --------------------------------+-- Instances for base types+-- --------------------------------++instance ConstraintsB Proxy where+  type AllB c Proxy = ()++  baddDicts _ = Proxy+  {-# INLINE baddDicts #-}++instance (ConstraintsB a, ConstraintsB b) => ConstraintsB (Product a b) where+  type AllB c (Product a b) = (AllB c a, AllB c b)++  baddDicts (Pair x y) = Pair (baddDicts x) (baddDicts y)+  {-# INLINE baddDicts #-}++instance (ConstraintsB a, ConstraintsB b) => ConstraintsB (Sum a b) where+  type AllB c (Sum a b) = (AllB c a, AllB c b)++  baddDicts (InL x) = InL (baddDicts x)+  baddDicts (InR x) = InR (baddDicts x)+  {-# INLINE baddDicts #-}++instance ConstraintsB (Const a) where+  type AllB c (Const a) = ()++  baddDicts (Const x) = Const x+  {-# INLINE baddDicts #-}++instance (Functor f, ConstraintsB b) => ConstraintsB (f `Compose` b) where+  type AllB c (f `Compose` b) = AllB c b++  baddDicts (Compose x)+    = Compose (baddDicts <$> x)+  {-# INLINE baddDicts #-}
src/Data/Barbie/Internal/Dicts.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE GADTs                   #-}+{-# LANGUAGE PolyKinds               #-} {-# LANGUAGE TypeFamilies            #-} {-# LANGUAGE UndecidableInstances    #-} {-# LANGUAGE UndecidableSuperClasses #-}@@ -12,7 +13,7 @@  where -import Data.Functor.Classes(Show1(..))+import Data.Functor.Classes (Show1(..))   -- | @'Dict' c a@ is evidence that there exists an instance of @c a@.@@ -41,7 +42,7 @@ --   equivalent to @c (f a)@. However, we have -- -- @--- 'ClassF c f :: * -> 'Constraint'+-- 'ClassF c f :: k -> 'Constraint' -- @ -- -- This is useful since it allows to define constraint-constructors like
src/Data/Barbie/Internal/Functor.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE TypeFamilies        #-}+{-# LANGUAGE PolyKinds    #-}+{-# LANGUAGE TypeFamilies #-} module Data.Barbie.Internal.Functor   ( FunctorB(..) @@ -9,7 +10,13 @@  where +import Data.Functor.Compose   (Compose (..))+import Data.Functor.Const     (Const (..))+import Data.Functor.Product   (Product (..))+import Data.Functor.Sum       (Sum (..)) import Data.Generics.GenericN+import Data.Proxy             (Proxy (..))+import Data.Kind              (Type)  -- | Barbie-types that can be mapped over. Instances of 'FunctorB' should --   satisfy the following laws:@@ -21,7 +28,7 @@ -- -- There is a default 'bmap' implementation for 'Generic' types, so -- instances can derived automatically.-class FunctorB b where+class FunctorB (b :: (k -> Type) -> Type) where   bmap :: (forall a . f a -> g a) -> b f -> b g    default bmap@@ -118,3 +125,29 @@ instance GFunctorB f g (Rec x x) (Rec x x) where   gbmap _ = id   {-# INLINE gbmap #-}+++-- --------------------------------+-- Instances for base types+-- --------------------------------++instance FunctorB Proxy where+  bmap _ _ = Proxy+  {-# INLINE bmap #-}++instance (FunctorB a, FunctorB b) => FunctorB (Product a b) where+  bmap f (Pair x y) = Pair (bmap f x) (bmap f y)+  {-# INLINE bmap #-}++instance (FunctorB a, FunctorB b) => FunctorB (Sum a b) where+  bmap f (InL x) = InL (bmap f x)+  bmap f (InR x) = InR (bmap f x)+  {-# INLINE bmap #-}++instance FunctorB (Const x) where+  bmap _ (Const x) = Const x+  {-# INLINE bmap #-}++instance (Functor f, FunctorB b) => FunctorB (f `Compose` b) where+  bmap h (Compose x) = Compose (bmap h <$> x)+  {-# INLINE bmap #-}
src/Data/Barbie/Internal/Instances.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE PolyKinds                  #-} {-# LANGUAGE TypeFamilies               #-} {-# LANGUAGE UndecidableInstances       #-} module Data.Barbie.Internal.Instances ( Barbie(..) )@@ -12,10 +13,11 @@ import Data.Barbie.Internal.Product import Data.Barbie.Internal.ProductC +import Data.Kind (Type) import Data.Semigroup (Semigroup, (<>))  -- | A wrapper for Barbie-types, providing useful instances.-newtype Barbie b (f :: * -> *)+newtype Barbie (b :: (k -> Type) -> Type) f   = Barbie { getBarbie :: b f }   deriving (FunctorB, ProductB, ProductBC) 
src/Data/Barbie/Internal/Product.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE AllowAmbiguousTypes  #-}+{-# LANGUAGE PolyKinds            #-} {-# LANGUAGE TypeFamilies         #-} {-# LANGUAGE UndecidableInstances #-} module Data.Barbie.Internal.Product@@ -13,10 +14,12 @@  where -import Data.Barbie.Internal.Functor(FunctorB(..))+import Data.Barbie.Internal.Functor (FunctorB (..)) -import Data.Functor.Product (Product(..)) import Data.Functor.Prod+import Data.Functor.Product (Product (..))+import Data.Kind            (Type)+import Data.Proxy           (Proxy (..))  import Data.Generics.GenericN @@ -59,7 +62,7 @@ -- -- There is a default implementation of 'bprod' and 'buniq' for 'Generic' types, -- so instances can derived automatically.-class FunctorB b => ProductB b where+class FunctorB b => ProductB (b :: (k -> Type) -> Type) where   bprod :: b f -> b g -> b (f `Product` g)    buniq :: (forall a . f a) -> b f@@ -165,7 +168,7 @@   = toN (gbuniq @f @f @_ @(RepN (b f)) @(RepN (b (f `Product` f))) x) {-# INLINE gbuniqDefault #-} -class GProductB (f :: * -> *) (g :: * -> *) repbf repbg repbfg where+class GProductB (f :: k -> *) (g :: k -> *) repbf repbg repbfg where   gbprod :: repbf x -> repbg x -> repbfg x    gbuniq :: (forall a . f a) -> repbf x@@ -237,3 +240,22 @@    gbuniq x = Rec (K1 (buniq x))   {-# INLINE gbuniq #-}+++-- --------------------------------+-- Instances for base types+-- --------------------------------++instance ProductB Proxy where+  bprod _ _ = Proxy+  {-# INLINE bprod #-}++  buniq _ = Proxy+  {-# INLINE buniq #-}++instance (ProductB a, ProductB b) => ProductB (Product a b) where+  bprod (Pair ll lr) (Pair rl rr) = Pair (bprod ll rl) (bprod lr rr)+  {-# INLINE bprod #-}++  buniq x = Pair (buniq x) (buniq x)+  {-# INLINE buniq #-}
src/Data/Barbie/Internal/ProductC.hs view
@@ -1,6 +1,7 @@-{-# LANGUAGE AllowAmbiguousTypes   #-}-{-# LANGUAGE TypeFamilies          #-}-{-# LANGUAGE UndecidableInstances  #-}+{-# LANGUAGE AllowAmbiguousTypes  #-}+{-# LANGUAGE PolyKinds            #-}+{-# LANGUAGE TypeFamilies         #-}+{-# LANGUAGE UndecidableInstances #-} module Data.Barbie.Internal.ProductC   ( ProductBC(..)   , buniqC@@ -19,12 +20,16 @@ where  import Data.Barbie.Internal.Constraints-import Data.Barbie.Internal.Dicts(ClassF, Dict(..), requiringDict)-import Data.Barbie.Internal.Functor(bmap)-import Data.Barbie.Internal.Product(ProductB(..))+import Data.Barbie.Internal.Dicts       (ClassF, Dict (..), requiringDict)+import Data.Barbie.Internal.Functor     (bmap)+import Data.Barbie.Internal.Product     (ProductB (..))+import Data.Kind                        (Type)  import Data.Generics.GenericN +import Data.Functor.Product (Product (..))+import Data.Proxy           (Proxy (..))+ -- | Every type @b@ that is an instance of both 'ProductB' and --   'ConstraintsB' can be made an instance of 'ProductBC' --   as well.@@ -51,7 +56,7 @@ -- -- There is a default implementation for 'Generic' types, so -- instances can derived automatically.-class (ConstraintsB b, ProductB b) => ProductBC b where+class (ConstraintsB b, ProductB b) => ProductBC (b :: (k -> Type) -> Type) where   bdicts :: AllB c b => b (Dict c)    default bdicts :: (CanDeriveProductBC c b, AllB c b) => b (Dict c)@@ -142,7 +147,7 @@   ) => GProductBC c (Rec (Self b (P0 X)) (b X))                     (Rec      (b (P0 (Dict c)))                               (b     (Dict c))) where-  gbdicts = Rec $ K1 $ bdicts @b+  gbdicts = Rec $ K1 $ bdicts @_ @b  instance   ( SameOrParam b b'@@ -151,4 +156,17 @@   ) => GProductBC c (Rec (Other b (P0 X)) (b' X))                     (Rec       (b (P0 (Dict c)))                                (b'    (Dict c))) where-  gbdicts = Rec $ K1 $ bdicts @b'+  gbdicts = Rec $ K1 $ bdicts @_ @b'+++-- --------------------------------+-- Instances for base types+-- --------------------------------++instance ProductBC Proxy where+  bdicts = Proxy+  {-# INLINE bdicts #-}++instance (ProductBC a, ProductBC b) => ProductBC (Product a b) where+  bdicts = Pair bdicts bdicts+  {-# INLINE bdicts #-}
src/Data/Barbie/Internal/Traversable.hs view
@@ -2,7 +2,8 @@ -- | -- Module      :  Data.Barbie.Internal.Traversable -----------------------------------------------------------------------------{-# LANGUAGE TypeFamilies       #-}+{-# LANGUAGE PolyKinds    #-}+{-# LANGUAGE TypeFamilies #-} module Data.Barbie.Internal.Traversable   ( TraversableB(..)   , btraverse_@@ -17,14 +18,17 @@  where -import Data.Barbie.Internal.Functor (FunctorB(..))+import Data.Barbie.Internal.Functor (FunctorB (..)) -import Data.Functor (void)-import Data.Functor.Compose (Compose(..))-import Data.Functor.Const (Const(..))-import Data.Functor.Identity (Identity(..))+import Data.Functor           (void)+import Data.Functor.Compose   (Compose (..))+import Data.Functor.Const     (Const (..))+import Data.Functor.Identity  (Identity (..))+import Data.Functor.Product   (Product (..))+import Data.Functor.Sum       (Sum (..))+import Data.Kind              (Type) import Data.Generics.GenericN-+import Data.Proxy             (Proxy (..))  -- | Barbie-types that can be traversed from left to right. Instances should --   satisfy the following laws:@@ -37,7 +41,7 @@ -- -- There is a default 'btraverse' implementation for 'Generic' types, so -- instances can derived automatically.-class FunctorB b => TraversableB b where+class FunctorB b => TraversableB (b :: (k -> Type) -> Type) where   btraverse :: Applicative t => (forall a . f a -> t (g a)) -> b f -> t (b g)    default btraverse@@ -206,3 +210,28 @@ tell :: Monoid w => w -> Wr w () tell w   = St (\s -> ((), s `mappend` w))+++-- Instances for base types++instance TraversableB Proxy where+  btraverse _ _ = pure Proxy+  {-# INLINE btraverse #-}++instance (TraversableB a, TraversableB b) => TraversableB (Product a b) where+  btraverse f (Pair x y) = Pair <$> btraverse f x <*> btraverse f y+  {-# INLINE btraverse #-}++instance (TraversableB a, TraversableB b) => TraversableB (Sum a b) where+  btraverse f (InL x) = InL <$> btraverse f x+  btraverse f (InR x) = InR <$> btraverse f x+  {-# INLINE btraverse #-}++instance TraversableB (Const a) where+  btraverse _ (Const x) = pure (Const x)+  {-# INLINE btraverse #-}++instance (Traversable f, TraversableB b) => TraversableB (f `Compose` b) where+  btraverse h (Compose x)+    = Compose <$> traverse (btraverse h) x+  {-# INLINE btraverse #-}
src/Data/Barbie/Trivial.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE PolyKinds #-} module Data.Barbie.Trivial   ( Void   , Unit (..)@@ -12,6 +13,7 @@ import Data.Barbie.Internal.Traversable(TraversableB(..))  import Data.Data (Data(..))+import Data.Kind (Type) import Data.Semigroup (Semigroup(..)) import Data.Typeable (Typeable) import GHC.Generics (Generic)@@ -22,7 +24,7 @@ ---------------------------------------------------  -- | Uninhabited barbie type.-data Void (f :: * -> *)+data Void (f :: k -> Type)   deriving (Generic, Typeable)  instance Eq   (Void f) where@@ -44,7 +46,7 @@   -- | A barbie type without structure.-data Unit (f :: * -> *)+data Unit (f :: k -> Type)   = Unit   deriving     ( Data, Generic, Typeable
src/Data/Functor/Prod.hs view
@@ -42,11 +42,12 @@ import Control.Applicative(Alternative(..)) import Data.Functor.Product(Product(..)) import Data.Functor.Classes(Eq1(..), Ord1(..), Show1(..))+import Data.Kind (Type)  import qualified Data.Functor.Classes as FC  -- | Product of n functors.-data Prod :: [* -> *] -> * -> * where+data Prod :: [k -> Type] -> k -> Type where   Unit :: Prod '[] a   Cons :: (f a) -> Prod fs a -> Prod (f ': fs) a 
src/Data/Generics/GenericN.hs view
@@ -33,7 +33,7 @@ import GHC.TypeLits import Data.Coerce -data Param (n :: Nat) (original :: k' -> k'') (a :: k)+data Param (n :: Nat) (original :: k -> k') (a :: k)  type family Indexed (t :: k) (i :: Nat) :: k where   Indexed (t a) i = Indexed t (i + 1) (Param i a)
test/Barbies.hs view
@@ -20,6 +20,8 @@   , InfRec(..)    , NestedF(..)++  , HKB(..)   )  where@@ -282,3 +284,21 @@ instance ProductB (ParX a) instance ConstraintsB (ParX a) instance ProductBC (ParX a)+++-----------------------------------------------------+-- Higher-kinded barbies+-----------------------------------------------------++data HKB b+  = HKB+      { hkb1 :: b Maybe+      , khb2 :: b ([])+      }+  deriving (Generic, Typeable)++instance FunctorB HKB+instance TraversableB HKB+instance ProductB HKB+instance ConstraintsB HKB+instance ProductBC HKB