generics-sop 0.5.0.0 → 0.5.1.0
raw patch · 7 files changed
+281/−179 lines, 7 filesdep +th-abstractiondep ~basedep ~ghc-primdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: th-abstraction
Dependency ranges changed: base, ghc-prim, template-haskell
API changes (from Hackage documentation)
- Generics.SOP: data NP (a :: k -> Type) (b :: [k])
- Generics.SOP: data NS (a :: k -> Type) (b :: [k])
- Generics.SOP: data Proxy (t :: k)
- Generics.SOP: data SList (a :: [k])
- Generics.SOP: data Shape (a :: [k])
- Generics.SOP: newtype ( (f :: l -> Type) :.: (g :: k -> l) ) (p :: k)
- Generics.SOP: newtype K a (b :: k)
- Generics.SOP: newtype POP (f :: k -> Type) (xss :: [[k]])
- Generics.SOP: newtype SOP (f :: k -> Type) (xss :: [[k]])
+ Generics.SOP: data Shape (a :: [k]) :: forall k. () => [k] -> Type
+ Generics.SOP: data Proxy (t :: k) :: forall k. () => k -> Type
+ Generics.SOP: infixl 7 `And`
+ Generics.SOP: infixr 1 -.->
+ Generics.SOP: infixr 5 :*
+ Generics.SOP: infixr 7 :.:
+ Generics.SOP: infixr 9 `Compose`
+ Generics.SOP: newtype K a (b :: k) :: forall k. () => Type -> k -> Type
+ Generics.SOP: newtype (-.->) (f :: k -> Type) (g :: k -> Type) (a :: k) :: forall k. () => k -> Type -> k -> Type -> k -> Type
+ Generics.SOP: newtype (:.:) (f :: l -> Type) (g :: k -> l) (p :: k) :: forall l k. () => l -> Type -> k -> l -> k -> Type
- Generics.SOP: Comp :: f (g p) -> (:.:) (f :: l -> Type) (g :: k -> l) (p :: k)
+ Generics.SOP: Comp :: f (g p) -> (:.:)
- Generics.SOP: Fn :: (f a -> g a) -> (-.->) (f :: k -> Type) (g :: k -> Type) (a :: k)
+ Generics.SOP: Fn :: (f a -> g a) -> (-.->)
- Generics.SOP: K :: a -> K a (b :: k)
+ Generics.SOP: K :: a -> K a
- Generics.SOP: POP :: NP (NP f) xss -> POP (f :: k -> Type) (xss :: [[k]])
+ Generics.SOP: POP :: NP (NP f) xss -> POP
- Generics.SOP: Proxy :: Proxy (t :: k)
+ Generics.SOP: Proxy :: Proxy
- Generics.SOP: SOP :: NS (NP f) xss -> SOP (f :: k -> Type) (xss :: [[k]])
+ Generics.SOP: SOP :: NS (NP f) xss -> SOP
- Generics.SOP: [:*] :: forall k (a :: k -> Type) (x :: k) (xs :: [k]). a x -> NP a xs -> NP a (x : xs)
+ Generics.SOP: [:*] :: forall k (a :: k -> Type) (b :: [k]) (x :: k) (xs :: [k]). () => a x -> NP a xs -> NP a (x : xs)
- Generics.SOP: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '[ '[x]]
+ Generics.SOP: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
- Generics.SOP: [Nil] :: forall k (a :: k -> Type). NP a ('[] :: [k])
+ Generics.SOP: [Nil] :: forall k (a :: k -> Type) (b :: [k]). () => NP a ([] :: [k])
- Generics.SOP: [SCons] :: forall k (xs :: [k]) (x :: k). SListI xs => SList (x : xs)
+ Generics.SOP: [SCons] :: forall k (a :: [k]) (xs :: [k]) (x :: k). SListI xs => SList (x : xs)
- Generics.SOP: [SNil] :: forall k. SList ('[] :: [k])
+ Generics.SOP: [SNil] :: forall k (a :: [k]). () => SList ([] :: [k])
- Generics.SOP: [S] :: forall k (a :: k -> Type) (xs :: [k]) (x :: k). NS a xs -> NS a (x : xs)
+ Generics.SOP: [S] :: forall k (a :: k -> Type) (b :: [k]) (xs :: [k]) (x :: k). () => NS a xs -> NS a (x : xs)
- Generics.SOP: [ShapeCons] :: forall k (xs :: [k]) (x :: k). SListI xs => Shape xs -> Shape (x : xs)
+ Generics.SOP: [ShapeCons] :: forall k (a :: [k]) (xs :: [k]) (x :: k). SListI xs => Shape xs -> Shape (x : xs)
- Generics.SOP: [ShapeNil] :: forall k. Shape ('[] :: [k])
+ Generics.SOP: [ShapeNil] :: forall k (a :: [k]). () => Shape ([] :: [k])
- Generics.SOP: [Z] :: forall k (a :: k -> Type) (x :: k) (xs :: [k]). a x -> NS a (x : xs)
+ Generics.SOP: [Z] :: forall k (a :: k -> Type) (b :: [k]) (x :: k) (xs :: [k]). () => a x -> NS a (x : xs)
- Generics.SOP: [apFn] :: (-.->) (f :: k -> Type) (g :: k -> Type) (a :: k) -> f a -> g a
+ Generics.SOP: [apFn] :: (-.->) -> f a -> g a
- Generics.SOP: apInjs_NP :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP f xs -> [NS f xs]
+ Generics.SOP: apInjs_NP :: SListI xs => NP f xs -> [NS f xs]
- Generics.SOP: apInjs_POP :: forall k (xss :: [[k]]) (f :: k -> Type). SListI xss => POP f xss -> [SOP f xss]
+ Generics.SOP: apInjs_POP :: SListI xss => POP f xss -> [SOP f xss]
- Generics.SOP: case_SList :: forall k (xs :: [k]) r. SListI xs => r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r (y : ys)) -> r xs
+ Generics.SOP: case_SList :: SListI xs => r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r (y : ys)) -> r xs
- Generics.SOP: ccase_SList :: forall k c (xs :: [k]) proxy r. All c xs => proxy c -> r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r (y : ys)) -> r xs
+ Generics.SOP: ccase_SList :: All c xs => proxy c -> r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r (y : ys)) -> r xs
- Generics.SOP: ccompare_NS :: forall k c proxy r f g (xs :: [k]). All c xs => proxy c -> r -> (forall (x :: k). c x => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
+ Generics.SOP: ccompare_NS :: All c xs => proxy c -> r -> (forall (x :: k). c x => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
- Generics.SOP: ccompare_SOP :: forall k (c :: k -> Constraint) proxy r (f :: k -> Type) (g :: k -> Type) (xss :: [[k]]). All2 c xss => proxy c -> r -> (forall (xs :: [k]). All c xs => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
+ Generics.SOP: ccompare_SOP :: All2 c xss => proxy c -> r -> (forall (xs :: [k]). All c xs => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
- Generics.SOP: class (Same h1 :: k2 -> Type -> l2 -> Type ~ h2, Same h2 :: k1 -> Type -> l1 -> Type ~ h1) => HTrans (h1 :: k1 -> Type -> l1 -> Type) (h2 :: k2 -> Type -> l2 -> Type)
+ Generics.SOP: class ((Same h1 :: k2 -> Type -> l2 -> Type) ~ h2, (Same h2 :: k1 -> Type -> l1 -> Type) ~ h1) => HTrans (h1 :: k1 -> Type -> l1 -> Type) (h2 :: k2 -> Type -> l2 -> Type)
- Generics.SOP: class Coercible f x g y => LiftedCoercible (f :: k -> k1) (g :: k2 -> k1) (x :: k) (y :: k2)
+ Generics.SOP: class Coercible f x g y => LiftedCoercible (f :: k -> k0) (g :: k1 -> k0) (x :: k) (y :: k1)
- Generics.SOP: compare_NS :: forall k r f g (xs :: [k]). r -> (forall (x :: k). () => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
+ Generics.SOP: compare_NS :: () => r -> (forall (x :: k). () => f x -> g x -> r) -> r -> NS f xs -> NS g xs -> r
- Generics.SOP: compare_SOP :: forall k r (f :: k -> Type) (g :: k -> Type) (xss :: [[k]]). r -> (forall (xs :: [k]). () => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
+ Generics.SOP: compare_SOP :: () => r -> (forall (xs :: [k]). () => NP f xs -> NP g xs -> r) -> r -> SOP f xss -> SOP g xss -> r
- Generics.SOP: cpara_SList :: All c xs => proxy c -> r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r ys -> r (y : ys)) -> r xs
+ Generics.SOP: cpara_SList :: All c xs => proxy c -> r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r ys -> r (y : ys)) -> r xs
- Generics.SOP: ejections :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP (Ejection f xs) xs
+ Generics.SOP: ejections :: SListI xs => NP (Ejection f xs) xs
- Generics.SOP: fn :: forall k f (a :: k) f'. (f a -> f' a) -> (f -.-> f') a
+ Generics.SOP: fn :: () => (f a -> f' a) -> (f -.-> f') a
- Generics.SOP: fn_2 :: forall k f (a :: k) f' f''. (f a -> f' a -> f'' a) -> (f -.-> (f' -.-> f'')) a
+ Generics.SOP: fn_2 :: () => (f a -> f' a -> f'' a) -> (f -.-> (f' -.-> f'')) a
- Generics.SOP: fn_3 :: forall k f (a :: k) f' f'' f'''. (f a -> f' a -> f'' a -> f''' a) -> (f -.-> (f' -.-> (f'' -.-> f'''))) a
+ Generics.SOP: fn_3 :: () => (f a -> f' a -> f'' a -> f''' a) -> (f -.-> (f' -.-> (f'' -.-> f'''))) a
- Generics.SOP: fn_4 :: forall k f (a :: k) f' f'' f''' f''''. (f a -> f' a -> f'' a -> f''' a -> f'''' a) -> (f -.-> (f' -.-> (f'' -.-> (f''' -.-> f'''')))) a
+ Generics.SOP: fn_4 :: () => (f a -> f' a -> f'' a -> f''' a -> f'''' a) -> (f -.-> (f' -.-> (f'' -.-> (f''' -.-> f'''')))) a
- Generics.SOP: fromList :: forall k (xs :: [k]) a. SListI xs => [a] -> Maybe (NP (K a :: k -> Type) xs)
+ Generics.SOP: fromList :: SListI xs => [a] -> Maybe (NP (K a :: k -> Type) xs)
- Generics.SOP: hap :: forall (f :: k -> Type) (g :: k -> Type) (xs :: l). HAp h => Prod h (f -.-> g) xs -> h f xs -> h g xs
+ Generics.SOP: hap :: HAp h => Prod h (f -.-> g) xs -> h f xs -> h g xs
- Generics.SOP: hapInjs :: forall (xs :: l) (f :: k -> Type). (HApInjs h, SListIN h xs) => Prod h f xs -> [h f xs]
+ Generics.SOP: hapInjs :: (HApInjs h, SListIN h xs) => Prod h f xs -> [h f xs]
- Generics.SOP: hcexpand :: forall c (xs :: l) proxy f. (HExpand h, AllN (Prod h) c xs) => proxy c -> (forall (x :: k). c x => f x) -> h f xs -> Prod h f xs
+ Generics.SOP: hcexpand :: (HExpand h, AllN (Prod h) c xs) => proxy c -> (forall (x :: k). c x => f x) -> h f xs -> Prod h f xs
- Generics.SOP: hcfoldMap :: forall k l h c (xs :: l) m proxy f. (HTraverse_ h, AllN h c xs, Monoid m) => proxy c -> (forall (a :: k). c a => f a -> m) -> h f xs -> m
+ Generics.SOP: hcfoldMap :: (HTraverse_ h, AllN h c xs, Monoid m) => proxy c -> (forall (a :: k). c a => f a -> m) -> h f xs -> m
- Generics.SOP: hcfor :: forall l h c (xs :: l) g proxy f. (HSequence h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall a. c a => f a -> g a) -> g (h I xs)
+ Generics.SOP: hcfor :: (HSequence h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall a. c a => f a -> g a) -> g (h I xs)
- Generics.SOP: hcfor_ :: forall k l h c (xs :: l) g proxy f. (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall (a :: k). c a => f a -> g ()) -> g ()
+ Generics.SOP: hcfor_ :: (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> h f xs -> (forall (a :: k). c a => f a -> g ()) -> g ()
- Generics.SOP: hcliftA :: forall k l h c (xs :: l) proxy f f'. (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hcliftA :: (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hcliftA' :: forall k (c :: k -> Constraint) (xss :: [[k]]) h proxy f f'. (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs) -> h f xss -> h f' xss
+ Generics.SOP: hcliftA' :: (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs) -> h f xss -> h f' xss
- Generics.SOP: hcliftA2 :: forall k l h c (xs :: l) proxy f f' f''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hcliftA2 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hcliftA2' :: forall k (c :: k -> Constraint) (xss :: [[k]]) h proxy f f' f''. (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs) -> Prod h f xss -> h f' xss -> h f'' xss
+ Generics.SOP: hcliftA2' :: (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs) -> Prod h f xss -> h f' xss -> h f'' xss
- Generics.SOP: hcliftA3 :: forall k l h c (xs :: l) proxy f f' f'' f'''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hcliftA3 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: hcliftA3' :: forall k (c :: k -> Constraint) (xss :: [[k]]) h proxy f f' f'' f'''. (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs -> f''' xs) -> Prod h f xss -> Prod h f' xss -> h f'' xss -> h f''' xss
+ Generics.SOP: hcliftA3' :: (All2 c xss, Prod h ~ (NP :: ([k] -> Type) -> [[k]] -> Type), HAp h) => proxy c -> (forall (xs :: [k]). All c xs => f xs -> f' xs -> f'' xs -> f''' xs) -> Prod h f xss -> Prod h f' xss -> h f'' xss -> h f''' xss
- Generics.SOP: hcmap :: forall k l h c (xs :: l) proxy f f'. (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hcmap :: (AllN (Prod h) c xs, HAp h) => proxy c -> (forall (a :: k). c a => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hcoerce :: forall (f :: k1 -> Type) (g :: k2 -> Type) (xs :: l1) (ys :: l2). (HTrans h1 h2, AllZipN (Prod h1) (LiftedCoercible f g) xs ys, HTrans h1 h2) => h1 f xs -> h2 g ys
+ Generics.SOP: hcoerce :: (HTrans h1 h2, AllZipN (Prod h1) (LiftedCoercible f g) xs ys) => h1 f xs -> h2 g ys
- Generics.SOP: hcollapse :: forall (xs :: l) a. (HCollapse h, SListIN h xs) => h (K a :: k -> Type) xs -> CollapseTo h a
+ Generics.SOP: hcollapse :: (HCollapse h, SListIN h xs) => h (K a :: k -> Type) xs -> CollapseTo h a
- Generics.SOP: hcpure :: forall c (xs :: l) proxy f. (HPure h, AllN h c xs) => proxy c -> (forall (a :: k). c a => f a) -> h f xs
+ Generics.SOP: hcpure :: (HPure h, AllN h c xs) => proxy c -> (forall (a :: k). c a => f a) -> h f xs
- Generics.SOP: hctraverse :: forall l h c (xs :: l) g proxy f. (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall a. c a => f a -> g a) -> h f xs -> g (h I xs)
+ Generics.SOP: hctraverse :: (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall a. c a => f a -> g a) -> h f xs -> g (h I xs)
- Generics.SOP: hctraverse' :: forall c (xs :: l) g proxy f f'. (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g (f' a)) -> h f xs -> g (h f' xs)
+ Generics.SOP: hctraverse' :: (HSequence h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g (f' a)) -> h f xs -> g (h f' xs)
- Generics.SOP: hctraverse_ :: forall c (xs :: l) g proxy f. (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g ()) -> h f xs -> g ()
+ Generics.SOP: hctraverse_ :: (HTraverse_ h, AllN h c xs, Applicative g) => proxy c -> (forall (a :: k). c a => f a -> g ()) -> h f xs -> g ()
- Generics.SOP: hczipWith :: forall k l h c (xs :: l) proxy f f' f''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hczipWith :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hczipWith3 :: forall k l h c (xs :: l) proxy f f' f'' f'''. (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hczipWith3 :: (AllN (Prod h) c xs, HAp h, HAp (Prod h)) => proxy c -> (forall (a :: k). c a => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: hd :: forall k f (x :: k) (xs :: [k]). NP f (x : xs) -> f x
+ Generics.SOP: hd :: () => NP f (x : xs) -> f x
- Generics.SOP: hexpand :: forall (xs :: l) f. (HExpand h, SListIN (Prod h) xs) => (forall (x :: k). () => f x) -> h f xs -> Prod h f xs
+ Generics.SOP: hexpand :: (HExpand h, SListIN (Prod h) xs) => (forall (x :: k). () => f x) -> h f xs -> Prod h f xs
- Generics.SOP: hfromI :: forall l1 k2 l2 h1 (f :: k2 -> Type) (xs :: l1) (ys :: l2) h2. (AllZipN (Prod h1) (LiftedCoercible I f) xs ys, HTrans h1 h2) => h1 I xs -> h2 f ys
+ Generics.SOP: hfromI :: (AllZipN (Prod h1) (LiftedCoercible I f) xs ys, HTrans h1 h2) => h1 I xs -> h2 f ys
- Generics.SOP: hindex :: forall (f :: k -> Type) (xs :: l). HIndex h => h f xs -> Int
+ Generics.SOP: hindex :: HIndex h => h f xs -> Int
- Generics.SOP: hliftA :: forall k l h (xs :: l) f f'. (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hliftA :: (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hliftA2 :: forall k l h (xs :: l) f f' f''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hliftA2 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hliftA3 :: forall k l h (xs :: l) f f' f'' f'''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hliftA3 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: hmap :: forall k l h (xs :: l) f f'. (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
+ Generics.SOP: hmap :: (SListIN (Prod h) xs, HAp h) => (forall (a :: k). () => f a -> f' a) -> h f xs -> h f' xs
- Generics.SOP: hpure :: forall (xs :: l) f. (HPure h, SListIN h xs) => (forall (a :: k). () => f a) -> h f xs
+ Generics.SOP: hpure :: (HPure h, SListIN h xs) => (forall (a :: k). () => f a) -> h f xs
- Generics.SOP: hsequence :: forall l h (xs :: l) f. (SListIN h xs, SListIN (Prod h) xs, HSequence h, Applicative f) => h f xs -> f (h I xs)
+ Generics.SOP: hsequence :: (SListIN h xs, SListIN (Prod h) xs, HSequence h, Applicative f) => h f xs -> f (h I xs)
- Generics.SOP: hsequence' :: forall (xs :: l) f (g :: k -> Type). (HSequence h, SListIN h xs, Applicative f) => h (f :.: g) xs -> f (h g xs)
+ Generics.SOP: hsequence' :: (HSequence h, SListIN h xs, Applicative f) => h (f :.: g) xs -> f (h g xs)
- Generics.SOP: hsequenceK :: forall k l h (xs :: l) f a. (SListIN h xs, SListIN (Prod h) xs, Applicative f, HSequence h) => h (K (f a) :: k -> Type) xs -> f (h (K a :: k -> Type) xs)
+ Generics.SOP: hsequenceK :: (SListIN h xs, SListIN (Prod h) xs, Applicative f, HSequence h) => h (K (f a) :: k -> Type) xs -> f (h (K a :: k -> Type) xs)
- Generics.SOP: htoI :: forall k1 l1 l2 h1 (f :: k1 -> Type) (xs :: l1) (ys :: l2) h2. (AllZipN (Prod h1) (LiftedCoercible f I) xs ys, HTrans h1 h2) => h1 f xs -> h2 I ys
+ Generics.SOP: htoI :: (AllZipN (Prod h1) (LiftedCoercible f I) xs ys, HTrans h1 h2) => h1 f xs -> h2 I ys
- Generics.SOP: htrans :: forall c (xs :: l1) (ys :: l2) proxy f g. (HTrans h1 h2, AllZipN (Prod h1) c xs ys) => proxy c -> (forall (x :: k1) (y :: k2). c x y => f x -> g y) -> h1 f xs -> h2 g ys
+ Generics.SOP: htrans :: (HTrans h1 h2, AllZipN (Prod h1) c xs ys) => proxy c -> (forall (x :: k1) (y :: k2). c x y => f x -> g y) -> h1 f xs -> h2 g ys
- Generics.SOP: htraverse' :: forall (xs :: l) g f f'. (HSequence h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g (f' a)) -> h f xs -> g (h f' xs)
+ Generics.SOP: htraverse' :: (HSequence h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g (f' a)) -> h f xs -> g (h f' xs)
- Generics.SOP: htraverse_ :: forall (xs :: l) g f. (HTraverse_ h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g ()) -> h f xs -> g ()
+ Generics.SOP: htraverse_ :: (HTraverse_ h, SListIN h xs, Applicative g) => (forall (a :: k). () => f a -> g ()) -> h f xs -> g ()
- Generics.SOP: hzipWith :: forall k l h (xs :: l) f f' f''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
+ Generics.SOP: hzipWith :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a) -> Prod h f xs -> h f' xs -> h f'' xs
- Generics.SOP: hzipWith3 :: forall k l h (xs :: l) f f' f'' f'''. (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
+ Generics.SOP: hzipWith3 :: (SListIN (Prod h) xs, HAp h, HAp (Prod h)) => (forall (a :: k). () => f a -> f' a -> f'' a -> f''' a) -> Prod h f xs -> Prod h f' xs -> h f'' xs -> h f''' xs
- Generics.SOP: injections :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP (Injection f xs) xs
+ Generics.SOP: injections :: SListI xs => NP (Injection f xs) xs
- Generics.SOP: lengthSList :: forall k (xs :: [k]) proxy. SListI xs => proxy xs -> Int
+ Generics.SOP: lengthSList :: SListI xs => proxy xs -> Int
- Generics.SOP: mapII :: (a -> b) -> I a -> I b
+ Generics.SOP: mapII :: () => (a -> b) -> I a -> I b
- Generics.SOP: mapIII :: (a -> b -> c) -> I a -> I b -> I c
+ Generics.SOP: mapIII :: () => (a -> b -> c) -> I a -> I b -> I c
- Generics.SOP: mapIIK :: forall k a b c (d :: k). (a -> b -> c) -> I a -> I b -> K c d
+ Generics.SOP: mapIIK :: () => (a -> b -> c) -> I a -> I b -> K c d
- Generics.SOP: mapIK :: forall k a b (c :: k). (a -> b) -> I a -> K b c
+ Generics.SOP: mapIK :: () => (a -> b) -> I a -> K b c
- Generics.SOP: mapIKI :: forall k a b c (d :: k). (a -> b -> c) -> I a -> K b d -> I c
+ Generics.SOP: mapIKI :: () => (a -> b -> c) -> I a -> K b d -> I c
- Generics.SOP: mapIKK :: forall k1 k2 a b c (d :: k1) (e :: k2). (a -> b -> c) -> I a -> K b d -> K c e
+ Generics.SOP: mapIKK :: () => (a -> b -> c) -> I a -> K b d -> K c e
- Generics.SOP: mapKI :: forall k a b (c :: k). (a -> b) -> K a c -> I b
+ Generics.SOP: mapKI :: () => (a -> b) -> K a c -> I b
- Generics.SOP: mapKII :: forall k a b c (d :: k). (a -> b -> c) -> K a d -> I b -> I c
+ Generics.SOP: mapKII :: () => (a -> b -> c) -> K a d -> I b -> I c
- Generics.SOP: mapKIK :: forall k1 k2 a b c (d :: k1) (e :: k2). (a -> b -> c) -> K a d -> I b -> K c e
+ Generics.SOP: mapKIK :: () => (a -> b -> c) -> K a d -> I b -> K c e
- Generics.SOP: mapKK :: forall k1 k2 a b (c :: k1) (d :: k2). (a -> b) -> K a c -> K b d
+ Generics.SOP: mapKK :: () => (a -> b) -> K a c -> K b d
- Generics.SOP: mapKKI :: forall k1 k2 a b c (d :: k1) (e :: k2). (a -> b -> c) -> K a d -> K b e -> I c
+ Generics.SOP: mapKKI :: () => (a -> b -> c) -> K a d -> K b e -> I c
- Generics.SOP: mapKKK :: forall k1 k2 k3 a b c (d :: k1) (e :: k2) (f :: k3). (a -> b -> c) -> K a d -> K b e -> K c f
+ Generics.SOP: mapKKK :: () => (a -> b -> c) -> K a d -> K b e -> K c f
- Generics.SOP: para_SList :: forall k (xs :: [k]) r. SListI xs => r ('[] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r ys -> r (y : ys)) -> r xs
+ Generics.SOP: para_SList :: SListI xs => r ([] :: [k]) -> (forall (y :: k) (ys :: [k]). SListI ys => r ys -> r (y : ys)) -> r xs
- Generics.SOP: projections :: forall k (xs :: [k]) (f :: k -> Type). SListI xs => NP (Projection f xs) xs
+ Generics.SOP: projections :: SListI xs => NP (Projection f xs) xs
- Generics.SOP: sList :: forall k (xs :: [k]). SListI xs => SList xs
+ Generics.SOP: sList :: SListI xs => SList xs
- Generics.SOP: shape :: forall k (xs :: [k]). SListI xs => Shape xs
+ Generics.SOP: shape :: SListI xs => Shape xs
- Generics.SOP: shift :: forall a1 (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Injection f xs a2 -> Injection f (x : xs) a2
+ Generics.SOP: shift :: () => Injection f xs a2 -> Injection f (x : xs) a2
- Generics.SOP: shiftEjection :: forall a1 (f :: a1 -> Type) (x :: a1) (xs :: [a1]) (a2 :: a1). Ejection f xs a2 -> Ejection f (x : xs) a2
+ Generics.SOP: shiftEjection :: () => Ejection f xs a2 -> Ejection f (x : xs) a2
- Generics.SOP: shiftInjection :: forall a1 (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Injection f xs a2 -> Injection f (x : xs) a2
+ Generics.SOP: shiftInjection :: () => Injection f xs a2 -> Injection f (x : xs) a2
- Generics.SOP: shiftProjection :: forall a1 (f :: a1 -> Type) (xs :: [a1]) (a2 :: a1) (x :: a1). Projection f xs a2 -> Projection f (x : xs) a2
+ Generics.SOP: shiftProjection :: () => Projection f xs a2 -> Projection f (x : xs) a2
- Generics.SOP: tl :: forall k (f :: k -> Type) (x :: k) (xs :: [k]). NP f (x : xs) -> NP f xs
+ Generics.SOP: tl :: () => NP f (x : xs) -> NP f xs
- Generics.SOP: type Ejection (f :: k -> Type) (xs :: [k]) = K NS f xs :: k -> Type -.-> Maybe :.: f
+ Generics.SOP: type Ejection (f :: k -> Type) (xs :: [k]) = (K NS f xs :: k -> Type) -.-> Maybe :.: f
- Generics.SOP: type Injection (f :: k -> Type) (xs :: [k]) = f -.-> K NS f xs :: k -> Type
+ Generics.SOP: type Injection (f :: k -> Type) (xs :: [k]) = f -.-> (K NS f xs :: k -> Type)
- Generics.SOP: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '[ '[x]])
+ Generics.SOP: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '['[x]])
- Generics.SOP: type Projection (f :: k -> Type) (xs :: [k]) = K NP f xs :: k -> Type -.-> f
+ Generics.SOP: type Projection (f :: k -> Type) (xs :: [k]) = (K NP f xs :: k -> Type) -.-> f
- Generics.SOP: type SListI = All Top :: k -> Constraint
+ Generics.SOP: type SListI = All (Top :: k -> Constraint)
- Generics.SOP: type SListI2 = All SListI :: [k] -> Constraint
+ Generics.SOP: type SListI2 = All (SListI :: [k] -> Constraint)
- Generics.SOP: type family SameShapeAs (xs :: [a]) (ys :: [b])
+ Generics.SOP: type family SameShapeAs (xs :: [a]) (ys :: [b]) :: Constraint
- Generics.SOP: unComp :: forall l k f (g :: k -> l) (p :: k). (f :.: g) p -> f (g p)
+ Generics.SOP: unComp :: () => (f :.: g) p -> f (g p)
- Generics.SOP: unI :: I a -> a
+ Generics.SOP: unI :: () => I a -> a
- Generics.SOP: unK :: forall k a (b :: k). K a b -> a
+ Generics.SOP: unK :: () => K a b -> a
- Generics.SOP: unPOP :: forall k (f :: k -> Type) (xss :: [[k]]). POP f xss -> NP (NP f) xss
+ Generics.SOP: unPOP :: () => POP f xss -> NP (NP f) xss
- Generics.SOP: unSOP :: forall k (f :: k -> Type) (xss :: [[k]]). SOP f xss -> NS (NP f) xss
+ Generics.SOP: unSOP :: () => SOP f xss -> NS (NP f) xss
- Generics.SOP: unZ :: forall k f (x :: k). NS f '[x] -> f x
+ Generics.SOP: unZ :: () => NS f (x : ([] :: [k])) -> f x
- Generics.SOP.Metadata: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '[ '[x]]
+ Generics.SOP.Metadata: [Newtype] :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
- Generics.SOP.Universe: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '[ '[x]])
+ Generics.SOP.Universe: type IsWrappedType (a :: Type) (x :: Type) = (Generic a, Code a ~ '['[x]])
Files
- CHANGELOG.md +7/−0
- bench/SOPBench/Type.hs +4/−4
- generics-sop.cabal +10/−6
- src/Generics/SOP/GGP.hs +6/−3
- src/Generics/SOP/TH.hs +203/−165
- src/Generics/SOP/Type/Metadata.hs +2/−0
- test/Example.hs +49/−1
CHANGELOG.md view
@@ -1,3 +1,10 @@+# 0.5.1.0 (2020-03-29)++* Compatibility with GHC-8.10 (thanks to Ryan Scott).++* Improve TH generation support and extend it to+ type families (thanks to Ryan Scott).+ # 0.5.0.0 (2019-05-09) * Add strictness info to the metadata. This means that
bench/SOPBench/Type.hs view
@@ -187,6 +187,8 @@ instance Show (S2 'SOPTH) where showsPrec = SOP.gshowsPrec +deriveGenericSubst ''S20 (const (promotedT 'SOPTH))+ instance Roundtrip (S20 'GHCGeneric) where roundtrip = ghcroundtrip @@ -204,8 +206,6 @@ instance SOP.Generic (S20 'SOPGGP) instance SOP.HasDatatypeInfo (S20 'SOPGGP) -deriveGenericSubst ''S20 (const (promotedT 'SOPTH))- instance Eq (S20 'SOPGGP) where (==) = SOP.geq @@ -218,6 +218,8 @@ instance Show (S20 'SOPTH) where showsPrec = SOP.gshowsPrec +deriveGenericSubst ''PB2 (const (promotedT 'SOPTH))+ instance Roundtrip (PB2 'GHCGeneric) where roundtrip = ghcroundtrip @@ -234,8 +236,6 @@ deriving instance GHC.Generic (PB2 'SOPGGP) instance SOP.Generic (PB2 'SOPGGP) instance SOP.HasDatatypeInfo (PB2 'SOPGGP)--deriveGenericSubst ''PB2 (const (promotedT 'SOPTH)) instance Eq (PB2 'SOPGGP) where (==) = SOP.geq
generics-sop.cabal view
@@ -1,5 +1,5 @@ name: generics-sop-version: 0.5.0.0+version: 0.5.1.0 synopsis: Generic Programming using True Sums of Products description: A library to support the definition of generic functions.@@ -42,7 +42,7 @@ build-type: Simple cabal-version: >=1.10 extra-source-files: CHANGELOG.md doctest.sh-tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.2, GHC == 8.10.1 source-repository head type: git@@ -65,10 +65,11 @@ Generics.SOP.NP Generics.SOP.NS Generics.SOP.Sing- build-depends: base >= 4.9 && < 5,+ build-depends: base >= 4.9 && < 4.15, sop-core == 0.5.0.*,- template-haskell >= 2.8 && < 2.15,- ghc-prim >= 0.3 && < 0.6+ template-haskell >= 2.8 && < 2.17,+ th-abstraction >= 0.3 && < 0.4,+ ghc-prim >= 0.3 && < 0.7 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall@@ -90,7 +91,10 @@ KindSignatures DataKinds FunctionalDependencies- AutoDeriveTypeable++ if impl(ghc <8.2)+ default-extensions: AutoDeriveTypeable+ -- if impl(ghc >= 8.6) -- default-extensions: NoStarIsType other-extensions: PolyKinds
src/Generics/SOP/GGP.hs view
@@ -137,7 +137,7 @@ -- This can most certainly be simplified class GSumFrom (a :: Type -> Type) where- gSumFrom :: a x -> SOP I xss -> SOP I (ToSumCode a xss)+ gSumFrom :: a x -> proxy xss -> SOP I (ToSumCode a xss) gSumSkip :: proxy a -> SOP I xss -> SOP I (ToSumCode a xss) instance GSumFrom V1 where@@ -145,7 +145,10 @@ gSumSkip _ xss = xss instance (GSumFrom a, GSumFrom b) => GSumFrom (a :+: b) where- gSumFrom (L1 a) xss = gSumFrom a (gSumSkip (Proxy :: Proxy b) xss)+ gSumFrom (L1 a) xss = gSumFrom a (toSumCodeProxy xss) where+ toSumCodeProxy :: proxy xss -> Proxy (ToSumCode b xss)+ toSumCodeProxy _ = Proxy+ gSumFrom (R1 b) xss = gSumSkip (Proxy :: Proxy a) (gSumFrom b xss) gSumSkip _ xss = gSumSkip (Proxy :: Proxy a) (gSumSkip (Proxy :: Proxy b) xss)@@ -208,7 +211,7 @@ -- For more info, see 'Generics.SOP.Generic'. -- gfrom :: (GFrom a, GHC.Generic a) => a -> SOP I (GCode a)-gfrom x = gSumFrom (GHC.from x) (error "gfrom: internal error" :: SOP.SOP SOP.I '[])+gfrom x = gSumFrom (GHC.from x) (Proxy :: Proxy '[]) -- | An automatically computed version of 'Generics.SOP.to'. --
src/Generics/SOP/TH.hs view
@@ -10,12 +10,12 @@ , deriveMetadataType ) where -import Control.Monad (join, replicateM)+import Control.Monad (join, replicateM, unless) import Data.List (foldl') import Data.Maybe (fromMaybe) import Data.Proxy import Language.Haskell.TH-import Language.Haskell.TH.Syntax+import Language.Haskell.TH.Datatype as TH import Generics.SOP.BasicFunctors import qualified Generics.SOP.Metadata as SOP@@ -83,7 +83,7 @@ -- deriveGenericSubst :: Name -> (Name -> Q Type) -> Q [Dec] deriveGenericSubst n f = do- dec <- reifyDec n+ dec <- reifyDatatype n ds1 <- withDataDec dec (deriveGenericForDataDec f) ds2 <- withDataDec dec (deriveMetadataForDataDec f) return (ds1 ++ ds2)@@ -94,7 +94,7 @@ -- deriveGenericOnlySubst :: Name -> (Name -> Q Type) -> Q [Dec] deriveGenericOnlySubst n f = do- dec <- reifyDec n+ dec <- reifyDatatype n withDataDec dec (deriveGenericForDataDec f) -- | Like 'deriveGenericOnly', but don't derive class instance, only functions.@@ -123,10 +123,10 @@ let codeName' = mkName codeName let fromName' = mkName fromName let toName' = mkName toName- dec <- reifyDec n- withDataDec dec $ \_isNewtype _cxt name bndrs cons _derivs -> do+ dec <- reifyDatatype n+ withDataDec dec $ \_variant _cxt name bndrs instTys cons -> do let codeType = codeFor varT cons -- '[ '[Int], '[Tree, Tree] ]- let origType = appTyVars varT name bndrs -- Tree+ let origType = appTysSubst varT name instTys -- Tree let repType = [t| SOP I $(appTyVars varT codeName' bndrs) |] -- SOP I TreeCode sequence [ tySynD codeName' bndrs codeType -- type TreeCode = '[ '[Int], '[Tree, Tree] ]@@ -156,10 +156,10 @@ deriveMetadataValue n codeName datatypeInfoName = do let codeName' = mkName codeName let datatypeInfoName' = mkName datatypeInfoName- dec <- reifyDec n- withDataDec dec $ \isNewtype _cxt name _bndrs cons _derivs -> do- sequence [ sigD datatypeInfoName' [t| SOP.DatatypeInfo $(conT codeName') |] -- treeDatatypeInfo :: DatatypeInfo TreeCode- , funD datatypeInfoName' [clause [] (normalB $ metadata' isNewtype name cons) []] -- treeDatatypeInfo = ...+ dec <- reifyDatatype n+ withDataDec dec $ \variant _cxt name bndrs _instTys cons -> do+ sequence [ sigD datatypeInfoName' [t| SOP.DatatypeInfo $(appTyVars varT codeName' bndrs) |] -- treeDatatypeInfo :: DatatypeInfo TreeCode+ , funD datatypeInfoName' [clause [] (normalB $ metadata' variant name cons) []] -- treeDatatypeInfo = ... ] {-# DEPRECATED deriveMetadataValue "Use 'deriveMetadataType' and 'demoteDatatypeInfo' instead." #-} @@ -180,24 +180,20 @@ deriveMetadataType :: Name -> String -> Q [Dec] deriveMetadataType n datatypeInfoName = do let datatypeInfoName' = mkName datatypeInfoName- dec <- reifyDec n- withDataDec dec $ \ isNewtype _ctx name _bndrs cons _derivs ->+ dec <- reifyDatatype n+ withDataDec dec $ \ variant _ctx name _bndrs _instTys cons -> sequence- [ tySynD datatypeInfoName' [] (metadataType' isNewtype name cons) ]+ [ tySynD datatypeInfoName' [] (metadataType' variant name cons) ] deriveGenericForDataDec ::- (Name -> Q Type) -> Bool -> Cxt -> Name -> [TyVarBndr] -> [Con] -> Derivings -> Q [Dec]-deriveGenericForDataDec f _isNewtype _cxt name bndrs cons _derivs = do- let typ = appTyVars f name bndrs+ (Name -> Q Type) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndr] -> [Type] -> [TH.ConstructorInfo] -> Q [Dec]+deriveGenericForDataDec f _variant _cxt name _bndrs instTys cons = do+ let typ = appTysSubst f name instTys deriveGenericForDataType f typ cons -deriveGenericForDataType :: (Name -> Q Type) -> Q Type -> [Con] -> Q [Dec]+deriveGenericForDataType :: (Name -> Q Type) -> Q Type -> [TH.ConstructorInfo] -> Q [Dec] deriveGenericForDataType f typ cons = do-#if MIN_VERSION_template_haskell(2,15,0)- let codeSyn = tySynInstD (tySynEqn Nothing [t| Code $typ |] (codeFor f cons))-#else- let codeSyn = tySynInstD ''Code $ tySynEqn [typ] (codeFor f cons)-#endif+ let codeSyn = tySynInstDCompat ''Code Nothing [typ] (codeFor f cons) inst <- instanceD (cxt []) [t| Generic $typ |]@@ -205,33 +201,33 @@ return [inst] deriveMetadataForDataDec ::- (Name -> Q Type) -> Bool -> Cxt -> Name -> [TyVarBndr] -> [Con] -> Derivings -> Q [Dec]-deriveMetadataForDataDec f isNewtype _cxt name bndrs cons _derivs = do- let typ = appTyVars f name bndrs- deriveMetadataForDataType isNewtype name typ cons+ (Name -> Q Type) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndr] -> [Type] -> [TH.ConstructorInfo] -> Q [Dec]+deriveMetadataForDataDec f variant _cxt name _bndrs instTys cons = do+ let typ = appTysSubst f name instTys+ deriveMetadataForDataType variant name typ cons -deriveMetadataForDataType :: Bool -> Name -> Q Type -> [Con] -> Q [Dec]-deriveMetadataForDataType isNewtype name typ cons = do+deriveMetadataForDataType :: DatatypeVariant -> Name -> Q Type -> [TH.ConstructorInfo] -> Q [Dec]+deriveMetadataForDataType variant name typ cons = do md <- instanceD (cxt []) [t| HasDatatypeInfo $typ |]- [ metadataType typ isNewtype name cons+ [ metadataType typ variant name cons , funD 'datatypeInfo [ clause [wildP] (normalB [| SOP.T.demoteDatatypeInfo (Proxy :: Proxy (DatatypeInfoOf $typ)) |]) [] ] ]- -- [metadata isNewtype name cons]+ -- [metadata variant name cons] return [md] {------------------------------------------------------------------------------- Computing the code for a data type -------------------------------------------------------------------------------} -codeFor :: (Name -> Q Type) -> [Con] -> Q Type+codeFor :: (Name -> Q Type) -> [TH.ConstructorInfo] -> Q Type codeFor f = promotedTypeList . map go where- go :: Con -> Q Type+ go :: TH.ConstructorInfo -> Q Type go c = do (_, ts) <- conInfo c promotedTypeListSubst f ts @@ -239,20 +235,20 @@ Computing the embedding/projection pair -------------------------------------------------------------------------------} -embedding :: Name -> [Con] -> Q Dec+embedding :: Name -> [TH.ConstructorInfo] -> Q Dec embedding fromName = funD fromName . go' (\e -> [| Z $e |]) where- go' :: (Q Exp -> Q Exp) -> [Con] -> [Q Clause]+ go' :: (Q Exp -> Q Exp) -> [TH.ConstructorInfo] -> [Q Clause] go' _ [] = (:[]) $ do x <- newName "x" clause [varP x] (normalB (caseE (varE x) [])) [] go' br cs = go br cs - go :: (Q Exp -> Q Exp) -> [Con] -> [Q Clause]+ go :: (Q Exp -> Q Exp) -> [TH.ConstructorInfo] -> [Q Clause] go _ [] = [] go br (c:cs) = mkClause br c : go (\e -> [| S $(br e) |]) cs - mkClause :: (Q Exp -> Q Exp) -> Con -> Q Clause+ mkClause :: (Q Exp -> Q Exp) -> TH.ConstructorInfo -> Q Clause mkClause br c = do (n, ts) <- conInfo c vars <- replicateM (length ts) (newName "x")@@ -260,16 +256,16 @@ (normalB [| SOP $(br . npE . map (appE (conE 'I) . varE) $ vars) |]) [] -projection :: Name -> [Con] -> Q Dec+projection :: Name -> [TH.ConstructorInfo] -> Q Dec projection toName = funD toName . go' where- go' :: [Con] -> [Q Clause]+ go' :: [TH.ConstructorInfo] -> [Q Clause] go' [] = (:[]) $ do x <- newName "x" clause [varP x] (normalB (caseE (varE x) [])) [] go' cs = go id cs - go :: (Q Pat -> Q Pat) -> [Con] -> [Q Clause]+ go :: (Q Pat -> Q Pat) -> [TH.ConstructorInfo] -> [Q Clause] go br [] = [mkUnreachableClause br] go br (c:cs) = mkClause br c : go (\p -> conP 'S [br p]) cs @@ -291,7 +287,7 @@ (normalB [| $(varE var) `seq` error "inaccessible" |]) [] - mkClause :: (Q Pat -> Q Pat) -> Con -> Q Clause+ mkClause :: (Q Pat -> Q Pat) -> TH.ConstructorInfo -> Q Clause mkClause br c = do (n, ts) <- conInfo c vars <- replicateM (length ts) (newName "x")@@ -303,74 +299,74 @@ Compute metadata -------------------------------------------------------------------------------} -metadataType :: Q Type -> Bool -> Name -> [Con] -> Q Dec-metadataType typ isNewtype typeName cs =-#if MIN_VERSION_template_haskell(2,15,0)- tySynInstD (tySynEqn Nothing [t| DatatypeInfoOf $typ |] (metadataType' isNewtype typeName cs))-#else- tySynInstD ''DatatypeInfoOf (tySynEqn [typ] (metadataType' isNewtype typeName cs))-#endif+metadataType :: Q Type -> DatatypeVariant -> Name -> [TH.ConstructorInfo] -> Q Dec+metadataType typ variant typeName cs =+ tySynInstDCompat ''DatatypeInfoOf Nothing [typ] (metadataType' variant typeName cs) -- | Derive term-level metadata.-metadata' :: Bool -> Name -> [Con] -> Q Exp-metadata' isNewtype typeName cs = md+metadata' :: DatatypeVariant -> Name -> [TH.ConstructorInfo] -> Q Exp+metadata' dataVariant typeName cs = md where md :: Q Exp- md | isNewtype = [| SOP.Newtype $(stringE (nameModule' typeName))- $(stringE (nameBase typeName))- $(mdCon (head cs))- |]- | otherwise = [| SOP.ADT $(stringE (nameModule' typeName))- $(stringE (nameBase typeName))- $(npE $ map mdCon cs)- $(popE $ map mdStrictness cs)- |]+ md | isNewtypeVariant dataVariant+ = [| SOP.Newtype $(stringE (nameModule' typeName))+ $(stringE (nameBase typeName))+ $(mdCon (head cs))+ |] - mdStrictness :: Con -> Q [Q Exp]- mdStrictness (NormalC n bts) = mdConStrictness n (map fst bts)- mdStrictness (RecC n vbts) = mdConStrictness n (map (\ (_, b, _) -> b) vbts)- mdStrictness (InfixC (b1, _) n (b2, _)) = mdConStrictness n [b1, b2]- mdStrictness (ForallC _ _ _) = fail "Existentials not supported"- mdStrictness (GadtC _ _ _) = fail "GADTs not supported"- mdStrictness (RecGadtC _ _ _) = fail "GADTs not supported"+ | otherwise+ = [| SOP.ADT $(stringE (nameModule' typeName))+ $(stringE (nameBase typeName))+ $(npE $ map mdCon cs)+ $(popE $ map mdStrictness cs)+ |] - mdConStrictness :: Name -> [Bang] -> Q [Q Exp]+ mdStrictness :: TH.ConstructorInfo -> Q [Q Exp]+ mdStrictness ci@(ConstructorInfo { constructorName = n+ , constructorStrictness = bs }) =+ checkForGADTs ci $ mdConStrictness n bs++ mdConStrictness :: Name -> [FieldStrictness] -> Q [Q Exp] mdConStrictness n bs = do dss <- reifyConStrictness n- return (zipWith (\ (Bang su ss) ds ->+ return (zipWith (\ (FieldStrictness su ss) ds -> [| SOP.StrictnessInfo- $(mdSourceUnpackedness su)- $(mdSourceStrictness ss)+ $(mdTHUnpackedness su)+ $(mdTHStrictness ss) $(mdDecidedStrictness ds) |]) bs dss) - mdCon :: Con -> Q Exp- mdCon (NormalC n _) = [| SOP.Constructor $(stringE (nameBase n)) |]- mdCon (RecC n ts) = [| SOP.Record $(stringE (nameBase n))- $(npE (map mdField ts))- |]- mdCon (InfixC _ n _) = do- fixity <- reifyFixity n- case fromMaybe defaultFixity fixity of- Fixity f a ->- [| SOP.Infix $(stringE (nameBase n)) $(mdAssociativity a) f |]- mdCon (ForallC _ _ _) = fail "Existentials not supported"- mdCon (GadtC _ _ _) = fail "GADTs not supported"- mdCon (RecGadtC _ _ _) = fail "GADTs not supported"+ mdCon :: TH.ConstructorInfo -> Q Exp+ mdCon ci@(ConstructorInfo { constructorName = n+ , constructorVariant = conVariant }) =+ checkForGADTs ci $+ case conVariant of+ NormalConstructor -> [| SOP.Constructor $(stringE (nameBase n)) |]+ RecordConstructor ts -> [| SOP.Record $(stringE (nameBase n))+ $(npE (map mdField ts))+ |]+ InfixConstructor -> do+ fixity <- reifyFixity n+ case fromMaybe defaultFixity fixity of+ Fixity f a -> [| SOP.Infix $(stringE (nameBase n))+ $(mdAssociativity a)+ f+ |] - mdField :: VarStrictType -> Q Exp- mdField (n, _, _) = [| SOP.FieldInfo $(stringE (nameBase n)) |] - mdSourceUnpackedness :: SourceUnpackedness -> Q Exp- mdSourceUnpackedness NoSourceUnpackedness = [| SOP.NoSourceUnpackedness |]- mdSourceUnpackedness SourceNoUnpack = [| SOP.SourceNoUnpack |]- mdSourceUnpackedness SourceUnpack = [| SOP.SourceUnpack |]+ mdField :: Name -> Q Exp+ mdField n = [| SOP.FieldInfo $(stringE (nameBase n)) |] - mdSourceStrictness :: SourceStrictness -> Q Exp- mdSourceStrictness NoSourceStrictness = [| SOP.NoSourceStrictness |]- mdSourceStrictness SourceLazy = [| SOP.SourceLazy |]- mdSourceStrictness SourceStrict = [| SOP.SourceStrict |]+ mdTHUnpackedness :: TH.Unpackedness -> Q Exp+ mdTHUnpackedness UnspecifiedUnpackedness = [| SOP.NoSourceUnpackedness |]+ mdTHUnpackedness NoUnpack = [| SOP.SourceNoUnpack |]+ mdTHUnpackedness Unpack = [| SOP.SourceUnpack |] + mdTHStrictness :: TH.Strictness -> Q Exp+ mdTHStrictness UnspecifiedStrictness = [| SOP.NoSourceStrictness |]+ mdTHStrictness Lazy = [| SOP.SourceLazy |]+ mdTHStrictness TH.Strict = [| SOP.SourceStrict |]+ mdDecidedStrictness :: DecidedStrictness -> Q Exp mdDecidedStrictness DecidedLazy = [| SOP.DecidedLazy |] mdDecidedStrictness DecidedStrict = [| SOP.DecidedStrict |]@@ -382,64 +378,67 @@ mdAssociativity InfixN = [| SOP.NotAssociative |] -- | Derive type-level metadata.-metadataType' :: Bool -> Name -> [Con] -> Q Type-metadataType' isNewtype typeName cs = md+metadataType' :: DatatypeVariant -> Name -> [TH.ConstructorInfo] -> Q Type+metadataType' dataVariant typeName cs = md where md :: Q Type- md | isNewtype = [t| 'SOP.T.Newtype $(stringT (nameModule' typeName))- $(stringT (nameBase typeName))- $(mdCon (head cs))- |]- | otherwise = [t| 'SOP.T.ADT $(stringT (nameModule' typeName))- $(stringT (nameBase typeName))- $(promotedTypeList $ map mdCon cs)- $(promotedTypeListOfList $ map mdStrictness cs)- |]+ md | isNewtypeVariant dataVariant+ = [t| 'SOP.T.Newtype $(stringT (nameModule' typeName))+ $(stringT (nameBase typeName))+ $(mdCon (head cs))+ |] - mdStrictness :: Con -> Q [Q Type]- mdStrictness (NormalC n bts) = mdConStrictness n (map fst bts)- mdStrictness (RecC n vbts) = mdConStrictness n (map (\ (_, b, _) -> b) vbts)- mdStrictness (InfixC (b1, _) n (b2, _)) = mdConStrictness n [b1, b2]- mdStrictness (ForallC _ _ _) = fail "Existentials not supported"- mdStrictness (GadtC _ _ _) = fail "GADTs not supported"- mdStrictness (RecGadtC _ _ _) = fail "GADTs not supported"+ | otherwise+ = [t| 'SOP.T.ADT $(stringT (nameModule' typeName))+ $(stringT (nameBase typeName))+ $(promotedTypeList $ map mdCon cs)+ $(promotedTypeListOfList $ map mdStrictness cs)+ |] - mdConStrictness :: Name -> [Bang] -> Q [Q Type]+ mdStrictness :: TH.ConstructorInfo -> Q [Q Type]+ mdStrictness ci@(ConstructorInfo { constructorName = n+ , constructorStrictness = bs }) =+ checkForGADTs ci $ mdConStrictness n bs++ mdConStrictness :: Name -> [FieldStrictness] -> Q [Q Type] mdConStrictness n bs = do dss <- reifyConStrictness n- return (zipWith (\ (Bang su ss) ds ->+ return (zipWith (\ (FieldStrictness su ss) ds -> [t| 'SOP.T.StrictnessInfo- $(mdSourceUnpackedness su)- $(mdSourceStrictness ss)+ $(mdTHUnpackedness su)+ $(mdTHStrictness ss) $(mdDecidedStrictness ds) |]) bs dss) - mdCon :: Con -> Q Type- mdCon (NormalC n _) = [t| 'SOP.T.Constructor $(stringT (nameBase n)) |]- mdCon (RecC n ts) = [t| 'SOP.T.Record $(stringT (nameBase n))- $(promotedTypeList (map mdField ts))- |]- mdCon (InfixC _ n _) = do- fixity <- reifyFixity n- case fromMaybe defaultFixity fixity of- Fixity f a ->- [t| 'SOP.T.Infix $(stringT (nameBase n)) $(mdAssociativity a) $(natT f) |]- mdCon (ForallC _ _ _) = fail "Existentials not supported"- mdCon (GadtC _ _ _) = fail "GADTs not supported"- mdCon (RecGadtC _ _ _) = fail "GADTs not supported"+ mdCon :: TH.ConstructorInfo -> Q Type+ mdCon ci@(ConstructorInfo { constructorName = n+ , constructorVariant = conVariant }) =+ checkForGADTs ci $+ case conVariant of+ NormalConstructor -> [t| 'SOP.T.Constructor $(stringT (nameBase n)) |]+ RecordConstructor ts -> [t| 'SOP.T.Record $(stringT (nameBase n))+ $(promotedTypeList (map mdField ts))+ |]+ InfixConstructor -> do+ fixity <- reifyFixity n+ case fromMaybe defaultFixity fixity of+ Fixity f a -> [t| 'SOP.T.Infix $(stringT (nameBase n))+ $(mdAssociativity a)+ $(natT f)+ |] - mdField :: VarStrictType -> Q Type- mdField (n, _, _) = [t| 'SOP.T.FieldInfo $(stringT (nameBase n)) |]+ mdField :: Name -> Q Type+ mdField n = [t| 'SOP.T.FieldInfo $(stringT (nameBase n)) |] - mdSourceUnpackedness :: SourceUnpackedness -> Q Type- mdSourceUnpackedness NoSourceUnpackedness = [t| 'SOP.NoSourceUnpackedness |]- mdSourceUnpackedness SourceNoUnpack = [t| 'SOP.SourceNoUnpack |]- mdSourceUnpackedness SourceUnpack = [t| 'SOP.SourceUnpack |]+ mdTHUnpackedness :: TH.Unpackedness -> Q Type+ mdTHUnpackedness UnspecifiedUnpackedness = [t| 'SOP.NoSourceUnpackedness |]+ mdTHUnpackedness NoUnpack = [t| 'SOP.SourceNoUnpack |]+ mdTHUnpackedness Unpack = [t| 'SOP.SourceUnpack |] - mdSourceStrictness :: SourceStrictness -> Q Type- mdSourceStrictness NoSourceStrictness = [t| 'SOP.NoSourceStrictness |]- mdSourceStrictness SourceLazy = [t| 'SOP.SourceLazy |]- mdSourceStrictness SourceStrict = [t| 'SOP.SourceStrict |]+ mdTHStrictness :: TH.Strictness -> Q Type+ mdTHStrictness UnspecifiedStrictness = [t| 'SOP.NoSourceStrictness |]+ mdTHStrictness Lazy = [t| 'SOP.SourceLazy |]+ mdTHStrictness TH.Strict = [t| 'SOP.SourceStrict |] mdDecidedStrictness :: DecidedStrictness -> Q Type mdDecidedStrictness DecidedLazy = [t| 'SOP.DecidedLazy |]@@ -483,13 +482,10 @@ Some auxiliary definitions for working with TH -------------------------------------------------------------------------------} -conInfo :: Con -> Q (Name, [Q Type])-conInfo (NormalC n ts) = return (n, map (return . (\(_, t) -> t)) ts)-conInfo (RecC n ts) = return (n, map (return . (\(_, _, t) -> t)) ts)-conInfo (InfixC (_, t) n (_, t')) = return (n, map return [t, t'])-conInfo (ForallC _ _ _) = fail "Existentials not supported"-conInfo (GadtC _ _ _) = fail "GADTs not supported"-conInfo (RecGadtC _ _ _) = fail "GADTs not supported"+conInfo :: TH.ConstructorInfo -> Q (Name, [Q Type])+conInfo ci@(ConstructorInfo { constructorName = n+ , constructorFields = ts }) =+ checkForGADTs ci $ return (n, map return ts) stringT :: String -> Q Type stringT = litT . strTyLit@@ -512,14 +508,18 @@ appsT :: Name -> [Q Type] -> Q Type appsT n = foldl' appT (conT n) -bndrToName :: TyVarBndr -> Name-bndrToName (PlainTV v ) = v-bndrToName (KindedTV v _) = v- appTyVars :: (Name -> Q Type) -> Name -> [TyVarBndr] -> Q Type appTyVars f n bndrs =- appsT n (map (f . bndrToName) bndrs)+ appsT n (map (f . tvName) bndrs) +appTysSubst :: (Name -> Q Type) -> Name -> [Type] -> Q Type+appTysSubst f n args =+ appsT n (map (substType f . unSigType) args)++unSigType :: Type -> Type+unSigType (SigT t _) = t+unSigType t = t+ substType :: (Name -> Q Type) -> Type -> Q Type substType f = go where@@ -536,20 +536,58 @@ -- in the benchmarking suite. So we can fall back on identity in all -- but the cases we need for the benchmarking suite. -reifyDec :: Name -> Q Dec-reifyDec name =- do info <- reify name- case info of TyConI dec -> return dec- _ -> fail "Info must be type declaration type."+-- Process a DatatypeInfo using continuation-passing style.+withDataDec :: TH.DatatypeInfo+ -> (DatatypeVariant+ -- The variety of data type+ -- (@data@, @newtype@, @data instance@, or @newtype instance@)+ -> Cxt+ -- The datatype context+ -> Name+ -- The data type's name+ -> [TyVarBndr]+ -- The datatype's type variable binders, both implicit and explicit.+ -- Examples:+ --+ -- - For `data Maybe a = Nothing | Just a`, the binders are+ -- [PlainTV a]+ -- - For `data Proxy (a :: k) = Proxy`, the binders are+ -- [PlainTV k, KindedTV a (VarT k)]+ -- - For `data instance DF Int (Maybe b) = DF b`, the binders are+ -- [PlainTV b]+ -> [Type]+ -- For vanilla data types, these are the explicitly bound+ -- type variable binders, but in Type form.+ -- For data family instances, these are the type arguments.+ -- Examples:+ --+ -- - For `data Maybe a = Nothing | Just a`, the types are+ -- [VarT a]+ -- - For `data Proxy (a :: k) = Proxy`, the types are+ -- [SigT (VarT a) (VarT k)]+ -- - For `data instance DF Int (Maybe b) = DF b`, the binders are+ -- [ConT ''Int, ConT ''Maybe `AppT` VarT b]+ -> [TH.ConstructorInfo]+ -- The data type's constructors+ -> Q a)+ -> Q a+withDataDec (TH.DatatypeInfo { datatypeContext = ctxt+ , datatypeName = name+ , datatypeVars = bndrs+ , datatypeInstTypes = instTypes+ , datatypeVariant = variant+ , datatypeCons = cons }) f =+ f variant ctxt name bndrs instTypes cons -withDataDec :: Dec -> (Bool -> Cxt -> Name -> [TyVarBndr] -> [Con] -> Derivings -> Q a) -> Q a-withDataDec (DataD ctxt name bndrs _ cons derivs) f = f False ctxt name bndrs cons derivs-withDataDec (NewtypeD ctxt name bndrs _ con derivs) f = f True ctxt name bndrs [con] derivs-withDataDec _ _ = fail "Can only derive labels for datatypes and newtypes."+checkForGADTs :: TH.ConstructorInfo -> Q a -> Q a+checkForGADTs (ConstructorInfo { constructorVars = exVars+ , constructorContext = exCxt }) q = do+ unless (null exVars) $ fail "Existentials not supported"+ unless (null exCxt) $ fail "GADTs not supported"+ q --- | Utility type synonym to cover changes in the TH code-#if MIN_VERSION_template_haskell(2,12,0)-type Derivings = [DerivClause]-#else-type Derivings = Cxt-#endif+isNewtypeVariant :: DatatypeVariant -> Bool+isNewtypeVariant Datatype = False+isNewtypeVariant DataInstance = False+isNewtypeVariant Newtype = True+isNewtypeVariant NewtypeInstance = True
src/Generics/SOP/Type/Metadata.hs view
@@ -33,7 +33,9 @@ , Associativity(..) ) where +#if __GLASGOW_HASKELL__ <802 import Data.Kind (Type)+#endif import Data.Proxy (Proxy (..)) import GHC.Generics ( Associativity(..)
test/Example.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE EmptyCase #-}+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE GADTs #-}@@ -8,7 +9,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PolyKinds #-} {-# OPTIONS_GHC -fno-warn-deprecations #-}-module Main (main, toTreeC) where+module Main (main, toTreeC, toDataFamC) where import qualified GHC.Generics as GHC import Generics.SOP@@ -67,6 +68,16 @@ instance Generic Void instance HasDatatypeInfo Void +data family DataFam a b c+data instance DataFam Int (Maybe b) c = DF b c+ deriving (GHC.Generic)++dataFam :: DataFam Int (Maybe Int) Int+dataFam = DF 1 2++instance Generic (DataFam Int (Maybe b) c)+instance HasDatatypeInfo (DataFam Int (Maybe b) c)+ instance Show Tree where show = gshow @@ -76,6 +87,9 @@ instance Show Void where show = gshow +instance (Show b, Show c) => Show (DataFam Int (Maybe b) c) where+ show = gshow+ instance Enumerable ABC where enum = genum @@ -101,6 +115,14 @@ deriveGeneric ''VoidB +data family DataFamB a b c+data instance DataFamB Int (Maybe b) c = DFB b c++dataFamB :: DataFamB Int (Maybe Int) Int+dataFamB = DFB 1 2++deriveGeneric 'DFB+ instance Show TreeB where show = gshow @@ -110,6 +132,9 @@ instance Show VoidB where show = gshow +instance (Show b, Show c) => Show (DataFamB Int (Maybe b) c) where+ show = gshow+ instance Enumerable ABCB where enum = genum @@ -129,6 +154,12 @@ data VoidC +data family DataFamC a b c+data instance DataFamC Int (Maybe b) c = DFC b c++dataFamC :: DataFamC Int (Maybe Int) Int+dataFamC = DFC 1 2+ deriveGenericFunctions ''TreeC "TreeCCode" "fromTreeC" "toTreeC" deriveMetadataValue ''TreeC "TreeCCode" "treeDatatypeInfo" deriveMetadataType ''TreeC "TreeDatatypeInfo"@@ -141,6 +172,10 @@ deriveMetadataValue ''VoidC "VoidCCode" "voidDatatypeInfo" deriveMetadataType ''VoidC "VoidDatatypeInfo" +deriveGenericFunctions 'DFC "DataFamCCode" "fromDataFamC" "toDataFamC"+deriveMetadataValue 'DFC "DataFamCCode" "dataFamDatatypeInfo"+deriveMetadataType 'DFC "DataFamDatatypeInfo"+ demotedTreeDatatypeInfo :: DatatypeInfo TreeCCode demotedTreeDatatypeInfo = T.demoteDatatypeInfo (Proxy :: Proxy TreeDatatypeInfo) @@ -150,6 +185,9 @@ demotedVoidDatatypeInfo :: DatatypeInfo VoidCCode demotedVoidDatatypeInfo = T.demoteDatatypeInfo (Proxy :: Proxy VoidDatatypeInfo) +demotedDataFamDatatypeInfo :: DatatypeInfo (DataFamCCode b c)+demotedDataFamDatatypeInfo = T.demoteDatatypeInfo (Proxy :: Proxy DataFamDatatypeInfo)+ instance Show TreeC where show x = gshowS (fromTreeC x) @@ -159,6 +197,9 @@ instance Show VoidC where show x = gshowS (fromVoidC x) +instance (Show b, Show c) => Show (DataFamC Int (Maybe b) c) where+ show x = gshowS (fromDataFamC x)+ instance Enumerable ABCC where enum = fmap toABCC genumS @@ -170,23 +211,30 @@ main = do print tree print abc+ print dataFam print $ (enum :: [ABC]) print $ (enum :: [Void]) print $ datatypeInfo (Proxy :: Proxy Tree) print $ datatypeInfo (Proxy :: Proxy Void)+ print $ datatypeInfo (Proxy :: Proxy (DataFam Int (Maybe Int) Int)) print treeB print abcB+ print dataFamB print $ (enum :: [ABCB]) print $ (enum :: [VoidB]) print $ datatypeInfo (Proxy :: Proxy TreeB) print $ datatypeInfo (Proxy :: Proxy VoidB)+ print $ datatypeInfo (Proxy :: Proxy (DataFamB Int (Maybe Int) Int)) print treeC print abcC+ print dataFamC print $ (enum :: [ABCC]) print $ (enum :: [VoidC]) print treeDatatypeInfo print demotedTreeDatatypeInfo+ print demotedDataFamDatatypeInfo print (treeDatatypeInfo == demotedTreeDatatypeInfo) print (abcDatatypeInfo == demotedABCDatatypeInfo) print (voidDatatypeInfo == demotedVoidDatatypeInfo)+ print (dataFamDatatypeInfo == demotedDataFamDatatypeInfo) print $ convertFull tree