Copyright | (C) 2021 QBayLogic B.V. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | QBayLogic B.V. <[email protected]> |
Safe Haskell | None |
Language | Haskell2010 |
Monad for random generation of clash-core types.
Synopsis
- data CoreGenT m a
- runCoreGenT :: CoreGenT m a -> CoreGenConfig -> m a
- data CoreGenConfig = CoreGenConfig {}
- defaultConfig :: CoreGenConfig
- canGenDataKinds :: forall m. Monad m => CoreGenT m Bool
- canGenPolyKinds :: forall m. Monad m => CoreGenT m Bool
- canGenRankNTypes :: forall m. Monad m => CoreGenT m Bool
- canGenTypeFamilies :: forall m. Monad m => CoreGenT m Bool
- canGenUndecidableInstances :: forall m. Monad m => CoreGenT m Bool
- class Applicative f => Alternative (f :: Type -> Type) where
- class (Monad m, Monad (GenBase m)) => MonadGen (m :: Type -> Type) where
- class Monad m => MonadReader r (m :: Type -> Type) | m -> r where
Documentation
The CoreGenT monad keeps track of features like language extensions which have an impact on what can be generated. This allows more meaningful random generation, as the output of generators can be constrained to the same variant of Haskell / Clash used by the caller.
Instances
MonadTrans CoreGenT Source # | |
Defined in Clash.Hedgehog.Core.Monad | |
Monad m => MonadReader CoreGenConfig (CoreGenT m) Source # | |
Defined in Clash.Hedgehog.Core.Monad ask :: CoreGenT m CoreGenConfig # local :: (CoreGenConfig -> CoreGenConfig) -> CoreGenT m a -> CoreGenT m a # reader :: (CoreGenConfig -> a) -> CoreGenT m a # | |
Monad m => Monad (CoreGenT m) Source # | |
Functor m => Functor (CoreGenT m) Source # | |
MonadFail m => MonadFail (CoreGenT m) Source # | |
Defined in Clash.Hedgehog.Core.Monad | |
Applicative m => Applicative (CoreGenT m) Source # | |
Defined in Clash.Hedgehog.Core.Monad | |
Alternative m => Alternative (CoreGenT m) Source # | |
MonadIO m => MonadIO (CoreGenT m) Source # | |
Defined in Clash.Hedgehog.Core.Monad | |
MonadGen m => MonadGen (CoreGenT m) Source # | |
type GenBase (CoreGenT m) Source # | |
Defined in Clash.Hedgehog.Core.Monad |
runCoreGenT :: CoreGenT m a -> CoreGenConfig -> m a Source #
Run a generator that generates types from clash-lib
. This is intended
to transform another monad which implements MonadGen
.
data CoreGenConfig Source #
The configuration of Haskell / Clash which the generated source adheres to. These are typically things which change what a user could potentially have written in a source file, such as language extensions.
Instances
Show CoreGenConfig Source # | |
Defined in Clash.Hedgehog.Core.Monad showsPrec :: Int -> CoreGenConfig -> ShowS # show :: CoreGenConfig -> String # showList :: [CoreGenConfig] -> ShowS # | |
Monad m => MonadReader CoreGenConfig (CoreGenT m) Source # | |
Defined in Clash.Hedgehog.Core.Monad ask :: CoreGenT m CoreGenConfig # local :: (CoreGenConfig -> CoreGenConfig) -> CoreGenT m a -> CoreGenT m a # reader :: (CoreGenConfig -> a) -> CoreGenT m a # |
defaultConfig :: CoreGenConfig Source #
The default configuration matches the set of language extensions which
are enabled by default when running clash
/ clashi
. For most projects,
this will likely be the most representative set of options.
Re-exports
class Applicative f => Alternative (f :: Type -> Type) where #
A monoid on applicative functors.
If defined, some
and many
should be the least solutions
of the equations:
The identity of <|>
(<|>) :: f a -> f a -> f a infixl 3 #
An associative binary operation
One or more.
Zero or more.
Instances
class (Monad m, Monad (GenBase m)) => MonadGen (m :: Type -> Type) where #
Class of monads which can generate input data for tests.
Instances
MonadGen m => MonadGen (MaybeT m) | |
Monad m => MonadGen (GenT m) | |
MonadGen m => MonadGen (CoreGenT m) Source # | |
MonadGen m => MonadGen (ReaderT r m) | |
MonadGen m => MonadGen (IdentityT m) | |
(MonadGen m, Monoid w) => MonadGen (WriterT w m) | |
(MonadGen m, Monoid w) => MonadGen (WriterT w m) | |
MonadGen m => MonadGen (StateT r m) | |
MonadGen m => MonadGen (StateT r m) | |
MonadGen m => MonadGen (ExceptT x m) | |
class Monad m => MonadReader r (m :: Type -> Type) | m -> r where #
See examples in Control.Monad.Reader.
Note, the partially applied function type (->) r
is a simple reader monad.
See the instance
declaration below.
Retrieves the monad environment.
:: (r -> r) | The function to modify the environment. |
-> m a |
|
-> m a |
Executes a computation in a modified environment.
:: (r -> a) | The selector function to apply to the environment. |
-> m a |
Retrieves a function of the current environment.