-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Structural assertions on generic type representations. -- -- Please see README.md. @package generic-type-asserts @version 0.3.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.Type.Assert.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 type representation. module Generic.Type.Assert -- | Type is not void i.e. has at least one constructor. type GAssertNotVoid a = Assert (IsNotVoid (StripD1 (Rep a))) (GAssertErrorVoid 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 is a sum type i.e. has >=2 constructors. -- -- Permits void types. type GAssertSum a = Assert (IsSum (StripD1 (Rep a))) (GAssertErrorNotSum a) -- | Type has only empty constructors. -- -- Permits void types. type GAssertEnum a = Assert (IsEnum (StripD1 (Rep a))) (GAssertErrorNotEnum a)