clash-lib-hedgehog-1.5.0: Hedgehog Generators for clash-lib
Copyright(C) 2021 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Hedgehog.Core.Type

Description

Random kind-directed generation of Kind and Type.

Synopsis

Documentation

genKindFrom :: forall m. (Alternative m, MonadGen m) => TyConMap -> UniqMap TyVar -> Kind -> CoreGenT m Kind Source #

Generate a kind which is valid for the given TyConMap. The kind may contain free variables which are given in a UniqMap, and is a valid fit for a hole with the given kind.

N.B. Although the kind generated is a fit for the given hole, calling a function like inferCoreKindOf may return a different kind. This is because quantifiers are both the introduction rule for kind arrows and a kind former of their own right, so for the hole

Type -> Type

a generated fit might be

forall a. a -> a

but this is then inferred to have the kind

Type

genClosedKindFrom :: forall m. (Alternative m, MonadGen m) => TyConMap -> Kind -> CoreGenT m Kind Source #

Generate a closed kind (one without any free variables). If you want to be able to use free variables in a kind, see genKindFrom.

genPolyTypeFrom :: forall m. (Alternative m, MonadGen m) => TyConMap -> UniqMap TyVar -> Kind -> CoreGenT m Type Source #

Generate a polymorphic type which is valid for the given environment. The generated type should have the specified kind, and may contain the specified free variables.

genClosedPolyType :: forall m. (Alternative m, MonadGen m) => TyConMap -> Kind -> CoreGenT m Type Source #

Generate a polymorphic type which is valid for the given environment. The generated type should have the specified kind, and no free variables.

genMonoTypeFrom :: forall m. (Alternative m, MonadGen m) => TyConMap -> UniqMap TyVar -> Kind -> CoreGenT m Type Source #

Generate a monomorphic type which is valid for the given environment. The generated type should have the specified kind, and may contain the specified free variables.

genClosedMonoType :: forall m. (Alternative m, MonadGen m) => TyConMap -> Kind -> CoreGenT m Type Source #

Generate a monomorphic type which is valid for the given environment. The generated type should have the specified kind, and no free variables.

genWithCodomain :: forall m. (Alternative m, MonadGen m) => Kind -> CoreGenT m KindOrType -> CoreGenT m KindOrType Source #

Generate a function where the codomain is the given type / kind. Any other restrictions are enforced by the given generator. This can be used with generators for kinds and types.