-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Structural assertions on generic data representations. -- -- Please see README.md. @package generic-data-asserts @version 0.2.0 -- | Descriptive type errors for generic representation assertion failures. -- -- These are potentially useful separately from the asserts, in places -- where we're unable to perform asserts which evaluate to -- Constraints e.g. type families, so we expose them neatly -- here. module Generic.Data.Rep.Error type GAssertError a msg = TypeError ('Text "Assertion on generic representation failed for type: " :<>: 'ShowType a :$$: 'Text "Message: " :<>: 'Text msg) type GAssertErrorVoid a = GAssertError a "not non-void type (>=1 constructor)" type GAssertErrorSum a = GAssertError a "not non-sum type (1 constructor)" type GAssertErrorNotSum a = GAssertError a "not sum type (>=2 constructors)" type GAssertErrorNotEnum a = GAssertError a "not enum type (all empty constructors)" -- | Structural assertions on generic data representation. module Generic.Data.Rep.Assert type family StripD1 a -- | Type is not void i.e. has at least one constructor. type GAssertNotVoid a = Assert (IsNotVoid (StripD1 (Rep a))) (GAssertErrorVoid a) type family IsNotVoid a -- | Type is not a sum type i.e. has at most one constructor. -- -- Permits void types. type GAssertNotSum a = Assert (IsNotSum (StripD1 (Rep a))) (GAssertErrorSum a) type family IsNotSum a -- | Type is a sum type i.e. has >=2 constructors. -- -- Permits void types. type GAssertSum a = Assert (IsSum (StripD1 (Rep a))) (GAssertErrorNotSum a) type family IsSum a -- | Type has only empty constructors. -- -- Permits void types. type GAssertEnum a = Assert (IsEnum (StripD1 (Rep a))) (GAssertErrorNotEnum a) type family IsEnum a type family ConsIsEmpty a -- | Type level boolean AND. type family And l r