| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Falsify.GenDefault
Contents
Description
Default generators
GenDefault (as well as Std) are exported from
Test.Falsify, so you will only need to import this module if you want to
make use of the deriving-via support.
Intended for unqualified import.
Synopsis
- class GenDefault tag a where
- genDefault :: Proxy tag -> Gen a
- newtype ViaTag tag' a = ViaTag {
- unViaTag :: a
- newtype ViaIntegral a = ViaIntegral {
- unViaIntegral :: a
- newtype ViaEnum a = ViaEnum {
- unViaEnum :: a
- newtype ViaList l (mn :: Nat) (mx :: Nat) = ViaList {
- unViaList :: l
- newtype ViaString s (mn :: Nat) (mx :: Nat) = ViaString {
- unViaString :: s
- newtype ViaGeneric tag a = ViaGeneric {
- unViaGeneric :: a
- class GGenDefault tag (f :: Type -> Type)
Documentation
class GenDefault tag a where Source #
Default generators
GenDefault is similar to QuickCheck's Arbitrary class
along with some deriving via helpers. Unlike Arbitrary, GenDefault
allows one to choose between sets of default generators with user-defined
tags. See Test.Falsify.GenDefault.Std for the standard tag with a few
useful instances.
Methods
genDefault :: Proxy tag -> Gen a Source #
Default generator for a
The type-level tag allows types a to have multiple defaults.
Instances
Deriving-via support
newtype ViaTag tag' a Source #
DerivingVia wrapper for types with default instances under other tags
Instances
| GenDefault tag' a => GenDefault tag (ViaTag tag' a) Source # | |
Defined in Test.Falsify.GenDefault | |
newtype ViaIntegral a Source #
DerivingVia wrapper for Integral types
Constructors
| ViaIntegral | |
Fields
| |
Instances
| (Integral a, FiniteBits a, Bounded a) => GenDefault tag (ViaIntegral a) Source # | |
Defined in Test.Falsify.GenDefault Methods genDefault :: Proxy tag -> Gen (ViaIntegral a) Source # | |
DerivingVia wrapper for Enum types
Instances
| (Enum a, Bounded a) => GenDefault tag (ViaEnum a) Source # | |
Defined in Test.Falsify.GenDefault | |
newtype ViaList l (mn :: Nat) (mx :: Nat) Source #
DerivingVia wrapper for FromList types
Instances
| (IsList l, GenDefault tag (Item l), KnownNat mn, KnownNat mx) => GenDefault tag (ViaList l mn mx) Source # | |
Defined in Test.Falsify.GenDefault | |
newtype ViaString s (mn :: Nat) (mx :: Nat) Source #
DerivingVia wrapper for FromString types
Constructors
| ViaString | |
Fields
| |
Instances
| (IsString s, GenDefault tag Char, KnownNat mn, KnownNat mx) => GenDefault tag (ViaString s mn mx) Source # | |
Defined in Test.Falsify.GenDefault | |
newtype ViaGeneric tag a Source #
DerivingVia wrapper for Generic types
Constructors
| ViaGeneric | |
Fields
| |
Instances
| (Generic t, GGenDefault tag (Rep t)) => GenDefault tag (ViaGeneric tag t) Source # | |
Defined in Test.Falsify.GenDefault Methods genDefault :: Proxy tag -> Gen (ViaGeneric tag t) Source # | |
class GGenDefault tag (f :: Type -> Type) Source #
Generic generator construction
For use with ViaGeneric.
Instances
| GGenDefault tag (U1 :: Type -> Type) Source # | |
Defined in Test.Falsify.GenDefault Methods ggenDefault :: Proxy tag -> Gen (U1 a) | |
| (GGenDefault tag a, GGenDefault tag b) => GGenDefault tag (a :*: b) Source # | |
Defined in Test.Falsify.GenDefault Methods ggenDefault :: Proxy tag -> Gen ((a :*: b) a0) | |
| (GGenDefault tag a, GGenDefault tag b) => GGenDefault tag (a :+: b) Source # | |
Defined in Test.Falsify.GenDefault Methods ggenDefault :: Proxy tag -> Gen ((a :+: b) a0) | |
| GenDefault tag a => GGenDefault tag (K1 i a :: Type -> Type) Source # | |
Defined in Test.Falsify.GenDefault Methods ggenDefault :: Proxy tag -> Gen (K1 i a a0) | |
| GGenDefault tag a => GGenDefault tag (M1 i c a) Source # | |
Defined in Test.Falsify.GenDefault Methods ggenDefault :: Proxy tag -> Gen (M1 i c a a0) | |