Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Test.Expr.Config
Description
Type safe extensible test configuration. See getConfig
for the access of
configuration values. This is bassically a heterogeneous map type which is
indexed by special keys which carry with themselves the information about the
type of the corresponding value.
Synopsis
- newtype TestConfig = TestConfig [ConfigEntry]
- getConfig :: forall ct. (Typeable ct, Eq ct) => TestConfig -> ct -> Maybe (ConfigValue ct)
- type family ConfigValue ct where ...
- data Expression = Expression
- type ExprName = String
- data JournalFd = JournalFd
- data TypeOrd = TypeOrd
- data TestPattern = TestPattern
- data DegenType = DegenType
- data ConfigEntry where
- ConfigEntry :: forall ct. Typeable ct => ct -> ConfigValue ct -> ConfigEntry
- liftSafeTH :: TestConfig -> Exp
Test Configuration
newtype TestConfig #
Test configration, should be accessed only using the getConfig
function.
Constructors
TestConfig [ConfigEntry] |
getConfig :: forall ct. (Typeable ct, Eq ct) => TestConfig -> ct -> Maybe (ConfigValue ct) #
Access to test configuration using test configuration keys. Suppose we
have a test configuration tc
which contains DegenType
and Expression
entries (and no other entries):
>>>
tc `getConfig` Expression
Just "foo">>>
tc `getConfig` DegenType
Just TEqual>>>
tc `getConfig` JournalFd
Nothing
Please note that the type of value depends on the value (and therefore a type) of the key.
type family ConfigValue ct where ... #
A mapping from key types to corresponding types of values.
Equations
ConfigValue Expression = ExprName | |
ConfigValue JournalFd = Fd | |
ConfigValue TypeOrd = TypeOrder | |
ConfigValue TestPattern = Q Pat | |
ConfigValue DegenType = Q Type |
Test Configuration Keys
data Expression #
A key for getting expression, value will be of type ExprName
Constructors
Expression |
Instances
Show Expression # | |
Defined in Test.Expr.Config Methods showsPrec :: Int -> Expression -> ShowS show :: Expression -> String showList :: [Expression] -> ShowS | |
Eq Expression # | |
Defined in Test.Expr.Config |
A key for getting journal, value will be of type JournalSink
Constructors
JournalFd |
data TestPattern #
A key for getting test value pattern, value will be of type Q
Pat
Constructors
TestPattern |
Instances
Show TestPattern # | |
Defined in Test.Expr.Config Methods showsPrec :: Int -> TestPattern -> ShowS show :: TestPattern -> String showList :: [TestPattern] -> ShowS | |
Eq TestPattern # | |
Defined in Test.Expr.Config |
A key for getting test degeneration type, value will be of type Q
Type
Constructors
DegenType |
Low-Level Interface
data ConfigEntry where #
Constructors
ConfigEntry :: forall ct. Typeable ct => ct -> ConfigValue ct -> ConfigEntry |
liftSafeTH :: TestConfig -> Exp #
This will lift options safe for use in evalutors to a TemplateHaskell expression which can be passed to the evaluator.