morley-1.7.0: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Util.CustomGeneric

Description

Generic deriving with unbalanced trees.

Synopsis

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.

Instance derivation

customGeneric :: String -> GenericStrategy -> Q [Dec] Source #