Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generic deriving with unbalanced trees.
Synopsis
- withDepths :: [CstrDepth] -> GenericStrategy
- rightBalanced :: GenericStrategy
- leftBalanced :: GenericStrategy
- rightComb :: GenericStrategy
- leftComb :: GenericStrategy
- cstr :: forall n. KnownNat n => [Natural] -> CstrDepth
- fld :: forall n. KnownNat n => Natural
- customGeneric :: String -> GenericStrategy -> Q [Dec]
Custom Generic strategies
withDepths :: [CstrDepth] -> GenericStrategy Source #
In this strategy the desired depths of contructors (in the type tree) and fields (in each constructor's tree) are provided manually and simply checked against the number of actual constructors and fields.
rightBalanced :: GenericStrategy Source #
Strategy to make right-balanced instances (both in constructors and fields).
leftBalanced :: GenericStrategy Source #
Strategy to make left-balanced instances (both in constructors and fields).
rightComb :: GenericStrategy Source #
Strategy to make fully right-leaning instances (both in constructors and fields).
leftComb :: GenericStrategy Source #
Strategy to make fully left-leaning instances (both in constructors and fields).
Depth usage helpers
cstr :: forall n. KnownNat n => [Natural] -> CstrDepth Source #
Helper for making a constructor depth.
Note that this is only intended to be more readable than directly using a
tuple with withDepths
and for the ability to be used in places where
RebindableSyntax
overrides the number literal resolution.
fld :: forall n. KnownNat n => Natural Source #
Helper for making a field depth.
Note that this is only intended to be more readable than directly using a
tuple with withDepths
and for the ability to be used in places where
RebindableSyntax
overrides the number literal resolution.