Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Functions for retrieving context information from within tests.
Synopsis
- getContext :: (HasLabel context l a, MonadReader context m) => Label l a -> m a
- getContextMaybe :: (MonadReader context m, KnownSymbol l, Typeable context, Typeable a) => Label l a -> m (Maybe a)
- getRunRoot :: HasBaseContextMonad context m => m (Maybe FilePath)
- getCurrentFolder :: HasBaseContextMonad context m => m (Maybe FilePath)
- getCommandLineOptions :: forall a context m. (HasCommandLineOptions context a, MonadReader context m) => m (CommandLineOptions a)
- getSomeCommandLineOptions :: forall context m. (HasSomeCommandLineOptions context, MonadReader context m) => m SomeCommandLineOptions
- getUserCommandLineOptions :: (HasCommandLineOptions context a, MonadReader context m) => m a
- pushContext :: forall m l a intro context. Label l intro -> intro -> ExampleT (LabelValue l intro :> context) m a -> ExampleT context m a
- popContext :: forall m l a intro context. Label l intro -> ExampleT context m a -> ExampleT (LabelValue l intro :> context) m a
Documentation
getContext :: (HasLabel context l a, MonadReader context m) => Label l a -> m a Source #
Get a context by its label.
getContextMaybe :: (MonadReader context m, KnownSymbol l, Typeable context, Typeable a) => Label l a -> m (Maybe a) Source #
Try to get a context by its label. If not is in scope, returns Nothing
.
getRunRoot :: HasBaseContextMonad context m => m (Maybe FilePath) Source #
Get the root folder of the on-disk test tree for the current run.
Will be Nothing
if the run isn't configured to use the disk.
getCurrentFolder :: HasBaseContextMonad context m => m (Maybe FilePath) Source #
Get the on-disk folder corresponding to the current node.
Will be Nothing
if the run isn't configured to use the disk, or if the current node is configured
not to create a folder.
getCommandLineOptions :: forall a context m. (HasCommandLineOptions context a, MonadReader context m) => m (CommandLineOptions a) Source #
Get the command line options, if configured.
Using the runSandwichWithCommandLineArgs
family of main functions will introduce these, or you can
introduce them manually.
getSomeCommandLineOptions :: forall context m. (HasSomeCommandLineOptions context, MonadReader context m) => m SomeCommandLineOptions Source #
Get existentially wrapped command line options, if configured.
Using the runSandwichWithCommandLineArgs
family of main functions will introduce these, or you can
introduce them manually.
getUserCommandLineOptions :: (HasCommandLineOptions context a, MonadReader context m) => m a Source #
Get the user command line options, if configured.
This just calls getCommandLineOptions
and pulls out the user options.
Low-level context management helpers
pushContext :: forall m l a intro context. Label l intro -> intro -> ExampleT (LabelValue l intro :> context) m a -> ExampleT context m a Source #
Push a label to the context.
popContext :: forall m l a intro context. Label l intro -> ExampleT context m a -> ExampleT (LabelValue l intro :> context) m a Source #
Remove a label from the context.