Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype GeneratorOptions = GeneratorOptions {}
- defaultGeneratorOptions :: GeneratorOptions
- makeSelectGenerator :: Name -> [Con] -> ExpQ
- makeConstructorGenerator :: Con -> ExpQ
- untagGenerator :: Con -> ExpQ
- tagName :: Con -> Q Name
- constructorParameterName :: Con -> Q Name
- constructorName :: Con -> Q Text
- nameOf :: Con -> Q Name
- typesOf :: Con -> Q [Type]
- assembleGeneratorsToRegistry :: GeneratorOptions -> Exp -> [Exp] -> ExpQ
- app :: GeneratorOptions -> ExpQ -> ExpQ -> ExpQ
- genFunOf :: ExpQ -> ExpQ
- funOf :: ExpQ -> ExpQ
Documentation
newtype GeneratorOptions Source #
Options for changing the generated TH code if checked = True then we use the <: operator which checks input otherwise we use the <+ operator which doesn't check inputs
Instances
Show GeneratorOptions Source # | |
Defined in Data.Registry.Internal.TH showsPrec :: Int -> GeneratorOptions -> ShowS # show :: GeneratorOptions -> String # showList :: [GeneratorOptions] -> ShowS # | |
Eq GeneratorOptions Source # | |
Defined in Data.Registry.Internal.TH (==) :: GeneratorOptions -> GeneratorOptions -> Bool # (/=) :: GeneratorOptions -> GeneratorOptions -> Bool # |
defaultGeneratorOptions :: GeneratorOptions Source #
By default we want to typecheck the generators
makeSelectGenerator :: Name -> [Con] -> ExpQ Source #
Create a generator for selecting between constructors of an ADT One parameter is a Gen Chooser in order to be able to later on switch the selection strategy
makeConstructorGenerator :: Con -> ExpQ Source #
untagGenerator :: Con -> ExpQ Source #
Remove the tag of a given constructor: fmap unTag g :: Gen (Tag "t" SomeType) -> Gen SomeType
assembleGeneratorsToRegistry :: GeneratorOptions -> Exp -> [Exp] -> ExpQ Source #
runQ [| fun g +: genFun e +: genFun f|] InfixE (Just (AppE (VarE Data.Registry.Registry.fun) (UnboundVarE g))) (VarE +:) (Just (InfixE (Just (AppE (VarE Data.Registry.Hedgehog.genFun) (UnboundVarE e))) (VarE Data.Registry.Registry.+:) (Just (AppE (VarE Data.Registry.Hedgehog.genFun) (UnboundVarE f)))))