Data.Generics.Internal.Families.Collect

generic-lens-core-2.2.1.0: Generically derive traversals, lenses and prisms.

Copyright | (C) 2020 Csongor Kiss
License | BSD3
Maintainer | Csongor Kiss <kiss.csongor.kiss@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Data.Generics.Internal.Families.Collect

Description

# Documentation

type family CollectTotalType t (f :: k -> Type) :: TypeStat where ... #

Equations

CollectTotalType t (C1 ('MetaCons ctor _1 _2) f :: k -> Type) = AddToStat ctor (CountType t f) EmptyStat |
CollectTotalType t (M1 _1 _2 r :: k -> Type) = CollectTotalType t r |
CollectTotalType t (l :+: r :: k -> Type) = MergeStat (CollectTotalType t l) (CollectTotalType t r) |

type family CollectPartialType (t :: [Type]) (f :: Type -> Type) :: [Symbol] where ... #

Equations

CollectPartialType t (l :+: r) = CollectPartialType t l ++ CollectPartialType t r |
CollectPartialType t (C1 ('MetaCons ctor _1 _2) f) = If (t == GTypes f) '[ctor] ('[] :: [Symbol]) |
CollectPartialType t (D1 _1 f) = CollectPartialType t f |

type family CollectField (t :: Symbol) (f :: k -> Type) :: TypeStat where ... #

Equations

CollectField t (C1 ('MetaCons ctor _1 _2) f :: k -> Type) = AddToStat ctor (CountField t f) EmptyStat |
CollectField t (M1 _1 _2 r :: k -> Type) = CollectField t r |
CollectField t (l :+: r :: k -> Type) = MergeStat (CollectField t l) (CollectField t r) |

type family CollectFieldsOrdered (r :: Type -> Type) :: [Symbol] where ... #

Equations

CollectFieldsOrdered (l :*: r) = Merge (CollectFieldsOrdered l) (CollectFieldsOrdered r) |
CollectFieldsOrdered (S1 ('MetaSel ('Just name) _1 _2 _3) _4) = '[name] |
CollectFieldsOrdered (M1 _1 m a) = CollectFieldsOrdered a |
CollectFieldsOrdered _1 = '[] :: [Symbol] |

data TypeStat #

Constructors

TypeStat |
Fields _containsNone :: [Symbol] _containsMultiple :: [Symbol] _containsOne :: [Symbol]

type family (xs :: [Symbol]) \\ (ys :: [Symbol]) :: [Symbol] where ... infixr 5 #

Equations

xs \\ ('[] :: [Symbol]) = xs |
('[] :: [Symbol]) \\ xs = '[] :: [Symbol] |
(x ': xs) \\ (y ': ys) = Sub' (CmpSymbol x y) x y xs ys |