HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulegeneric-random-1.5.0.1Haskell2010

Generic.Random.Internal.BaseCase

Base case discovery.

Warning

This is an internal module: it is not subject to any versioning policy, breaking changes can happen at any time.

If something here seems useful, please report it or create a pull request to export it from an external module.

  • 3 types
  • 10 classes
  • 3 values
valuegenericArbitrary'
  1. :: (GArbitrary SizedOptsDef a, BaseCase a)
  2. => Weights a

    List of weights for every constructor

  3. -> Gen a
#

Decrease size to ensure termination for recursive types, looking for base cases once the size reaches 0.

genericArbitrary' (17 % 19 % 23 % ()) :: Gen a

N.B.: This replaces the generator for fields of type [t] with Test.QuickCheck.listOf' arbitrary instead of listOf arbitrary (i.e., arbitrary for lists).

valuewithBaseCase :: Gen a -> Gen a -> Gen a
#

Run the first generator if the size is positive. Run the second if the size is zero.

defaultGen `withBaseCase` baseCaseGen
classclass BaseCaseSearch a (z :: Nat) (y :: Maybe Nat) e where
#

Find a base case of type a with maximum depth z, recursively using BaseCaseSearch instances to search deeper levels.

y is the depth of a base case, if found.

e is the original type the search started with, that a appears in. It is used for error reporting.

Methods

Instances11BaseCaseSearch, …
classclass BaseCase a where
#

Custom instances can override the default behavior.

Methods

Instances1BaseCase
familytype family IfM (b :: Maybe t) (c :: k) (d :: k) :: k
#
Instances2IfM
  • type IfM 'Nothing c d = dDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type IfM ('Just t2) c d = cDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
familytype family IsEQ (e :: Ordering) :: Bool
#
Instances3IsEQ
  • type IsEQ 'EQ = 'TrueDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type IsEQ 'GT = 'FalseDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type IsEQ 'LT = 'FalseDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
familytype family (||?) (b :: Maybe Nat) (c :: Maybe Nat) :: Maybe Nat
#
Instances3||?
  • type (||?) 'Nothing n = nDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type (||?) ('Just m) ('Just n) = 'Just (Min m n)Defined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type (||?) m 'Nothing = mDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
familytype family (&&?) (b :: Maybe Nat) (c :: Maybe Nat) :: Maybe Nat
#
Instances3&&?
  • type (&&?) 'Nothing n = 'NothingDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type (&&?) ('Just m) ('Just n) = 'Just (Max m n)Defined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type (&&?) m 'Nothing = 'NothingDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
familytype family MaxOf (e :: Ordering) (m :: k) (n :: k) :: k
#
Instances3MaxOf
  • type MaxOf 'EQ m n = mDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type MaxOf 'GT m n = mDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type MaxOf 'LT m n = nDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
familytype family MinOf (e :: Ordering) (m :: k) (n :: k) :: k
#
Instances3MinOf
  • type MinOf 'EQ m n = nDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type MinOf 'GT m n = nDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • type MinOf 'LT m n = mDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
classclass Alternative (IfM y Weighted Proxy) => GBCS (f :: k -> Type) (z :: Nat) (y :: Maybe Nat) e where
#

Methods

Instances7GBCS, …
classclass Alternative (IfM (yf ||? yg) Weighted Proxy) => GBCSSum (f :: k -> Type) (g :: k -> Type) (z :: k1) (e :: k2) (yf :: Maybe Nat) (yg :: Maybe Nat) where
#

Methods

Instances4GBCSSum
classclass GBCSSumCompare (f :: k -> Type) (g :: k -> Type) (z :: k1) (e :: k2) (o :: k3) where
#

Methods

Instances3GBCSSumCompare
  • GBCSSumCompare f g z e 'EQDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • GBCSSumCompare f g z e 'GTDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • GBCSSumCompare f g z e 'LTDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
classclass Alternative (IfM (yf &&? yg) Weighted Proxy) => GBCSProduct (f :: k -> Type) (g :: k -> Type) (z :: k1) (e :: k2) (yf :: Maybe Nat) (yg :: Maybe Nat) where
#

Methods

Instances2GBCSProduct
  • (yf &&? yg) ~ 'Nothing => GBCSProduct f g z e yf ygDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • GBCSProduct f g z e ('Just m) ('Just n)Defined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
classclass IsMaybe (b :: Maybe t) where
#

Methods

  • ifMmap :: proxy b -> (c a -> c' a') -> (d a -> d' a') -> IfM b c d a -> IfM b c' d' a'
  • ifM :: proxy b -> c a -> d a -> IfM b c d a
Instances2IsMaybe
  • IsMaybe 'NothingDefined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase
  • IsMaybe ('Just t2)Defined in generic-random-1.5.0.1 · Generic.Random.Internal.BaseCase