hls-tactics-plugin-1.6.1.0: Wingman plugin for Haskell Language Server
Safe HaskellNone
LanguageHaskell2010

Wingman.KnownStrategies.QuickCheck

Synopsis

Documentation

deriveArbitrary :: TacticsM () Source #

Known tactic for deriving arbitrary :: Gen a. This tactic splits the type's data cons into terminal and inductive cases, and generates code that produces a terminal if the QuickCheck size parameter is <=1, or any data con otherwise. It correctly scales recursive parameters, ensuring termination.

data Generator Source #

Helper data type for the generator of a specific data con.

mkGenerator :: TyCon -> [Type] -> DataCon -> Generator Source #

Make a Generator for a given tycon instantiated with the given [Type].

doesTypeContain :: TyCon -> Type -> Bool Source #

Check if the given TyCon exists anywhere in the Type.

mkArbitraryCall :: TyCon -> Integer -> Type -> HsExpr GhcPs Source #

Generate the correct sort of call to arbitrary. For recursive calls, we need to scale down the size parameter, either by a constant factor of 1 if it's the only recursive parameter, or by div n where n is the number of recursive parameters. For all other types, just call arbitrary directly.