hedgehog-generic-0.1: GHC Generics automatically derived hedgehog generators

Safe HaskellNone
LanguageHaskell2010

Hedgehog.Generic

Description

Generic implementation of a generator. Example usage:

data Foo = Foo
  { _fooX :: X
  , _fooY :: Y
  } deriving (Generic)

genFoo :: Gen Foo
genFoo = hgen

The generated generator is equivalent to

Foo <$> hgen <*> hgen.

Synopsis

Documentation

class HGen a where Source #

A class used to generate generators for types implementing Generic.

Methods

hgen' :: Gen (a x) Source #

Instances
HGen (U1 :: Type -> Type) Source # 
Instance details

Defined in Hedgehog.Generic

Methods

hgen' :: Gen (U1 x) Source #

(Generic c, HGen (Rep c)) => HGen (K1 i c :: Type -> Type) Source # 
Instance details

Defined in Hedgehog.Generic

Methods

hgen' :: Gen (K1 i c x) Source #

(KnownNat (SumLen a), KnownNat (SumLen b), HGen a, HGen b) => HGen (a :+: b) Source # 
Instance details

Defined in Hedgehog.Generic

Methods

hgen' :: Gen ((a :+: b) x) Source #

(HGen a, HGen b) => HGen (a :*: b) Source # 
Instance details

Defined in Hedgehog.Generic

Methods

hgen' :: Gen ((a :*: b) x) Source #

HGen f => HGen (M1 i c f) Source # 
Instance details

Defined in Hedgehog.Generic

Methods

hgen' :: Gen (M1 i c f x) Source #

hgen :: (Generic a, HGen (Rep a)) => Gen a Source #

If your type implements Generic, you can get a generator for your type 'for free' using this function.