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

Modulehedgehog-fn-1.0Haskell2010

Hedgehog.Function.Internal

  • 4 types
  • 4 classes
  • 18 values
  • Packagehedgehog-fn-1.0
  • Exports26
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs
datadata (:->) a c where
#

Shrinkable, showable functions

Claessen, K. (2012, September). Shrinking and showing functions:(functional pearl). In ACM SIGPLAN Notices (Vol. 47, No. 12, pp. 73-80). ACM.

Constructors

Instances2Functor, Show
  • Functor ((:->) r)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (Show a, Show b) => Show (a :-> b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
valuetable :: a :-> c -> [(a, c)]
#

Tabulate the function

classclass GArg (a :: Type -> Type) where
#

Methods

Instances6GArg
  • GArg U1Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • GArg V1Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg b => GArg (K1 a b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (GArg a, GArg b) => GArg (a :*: b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (GArg a, GArg b) => GArg (a :+: b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • GArg c => GArg (M1 a b c)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
classclass Arg a where
#

instance Arg A where allows functions which take As to be reified

Methods

Instances14Arg, …
  • Arg IntegerDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg VoidDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg Int16Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg Int32Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg Int64Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg Int8Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg BoolDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg IntDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg OrderingDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg ()Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg a => Arg (Maybe a)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Arg a => Arg [a]Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (Arg a, Arg b) => Arg (Either a b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (Arg a, Arg b) => Arg (a, b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
classclass GVary (a :: Type -> Type) where
#

Methods

Instances6GVary
  • GVary U1Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • GVary V1Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary b => GVary (K1 a b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (GVary a, GVary b) => GVary (a :*: b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (GVary a, GVary b) => GVary (a :+: b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • GVary c => GVary (M1 a b c)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
classclass Vary a where
#

Vary provides a canonical co-generator for a type.

While technically there are many possible co-generators for a given type, we don't get any benefit from caring.

Methods

Instances15Vary, …
  • Vary IntegerDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary VoidDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary Int16Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary Int32Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary Int64Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary Int8Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary Word8Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary BoolDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary IntDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary OrderingDefined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary ()Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary a => Vary (Maybe a)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • Vary a => Vary [a]Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (Vary a, Vary b) => Vary (Either a b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
  • (Vary a, Vary b) => Vary (a, b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
newtypenewtype CoGenT (m :: Type -> Type) a
#

A CoGenT m a is used to perturb a GenT m b based on the value of the a. This way, the generated function will have a varying (but still deterministic) right hand side.

Co-generators can be built using Divisible and Decidable, but it is recommended to derive Generic and use the default instance of the Vary type class.

CoGenT m ~ Data.Functor.Contravariabe.Op (Endo (GenT m b))

Constructors

Instances3Contravariant, Decidable, Divisible
valueapply' :: a :-> b -> a -> Maybe b
#

Evaluate a possibly partial function

valueunsafeApply :: a :-> b -> a -> b
#

Evaluate a total function. Unsafe.

datadata Fn a b
#

The type of randomly-generated functions

Constructors

Instances1Show
  • (Show a, Show b) => Show (Fn a b)Defined in hedgehog-fn-1.0 · Hedgehog.Function.Internal
valueshrinkFn :: (b -> [b]) -> a :-> b -> [a :-> b]
#

Shrink the function

valueapply :: Fn a b -> a -> b
#

Evaluate an Fn

valuefnWith :: Arg a => CoGen a -> Gen b -> Gen (Fn a b)
#

Generate a function using the user-supplied co-generator

valuevia :: Arg b => (a -> b) -> (b -> a) -> (a -> c) -> a :-> c
#

Reify a function via an isomorphism.

If your function's domain has no instance of Generic then you can still reify it using an isomorphism to a better domain type. For example, the Arg instance for Integral uses an isomorphism from Integral a => a to (Bool, [Bool]), where the first element is the sign, and the second element is the bit-string.

Note: via f g will only be well-behaved if g . f = id and f . g = id

valuegvia :: GArg b => (a -> b x) -> (b x -> a) -> (a -> c) -> a :-> c
#