{-# LANGUAGE MonoLocalBinds #-}
module Test.Sandwich.Contexts where
import Control.Monad.Reader
import GHC.Stack
import Test.Sandwich.Types.ArgParsing
import Test.Sandwich.Types.RunTree
import Test.Sandwich.Types.Spec
getContext :: (Monad m, HasLabel context l a, HasCallStack, MonadReader context m) => Label l a -> m a
getContext :: forall (m :: * -> *) context (l :: Symbol) a.
(Monad m, HasLabel context l a, HasCallStack,
MonadReader context m) =>
Label l a -> m a
getContext = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall context (l :: Symbol) a.
HasLabel context l a =>
Label l a -> context -> a
getLabelValue
getRunRoot :: (Monad m, HasBaseContext context, MonadReader context m) => m (Maybe FilePath)
getRunRoot :: forall (m :: * -> *) context.
(Monad m, HasBaseContext context, MonadReader context m) =>
m (Maybe FilePath)
getRunRoot = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks (BaseContext -> Maybe FilePath
baseContextRunRoot forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. HasBaseContext a => a -> BaseContext
getBaseContext)
getCurrentFolder :: (HasBaseContext context, MonadReader context m, MonadIO m) => m (Maybe FilePath)
getCurrentFolder :: forall context (m :: * -> *).
(HasBaseContext context, MonadReader context m, MonadIO m) =>
m (Maybe FilePath)
getCurrentFolder = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks (BaseContext -> Maybe FilePath
baseContextPath forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. HasBaseContext a => a -> BaseContext
getBaseContext)
getCommandLineOptions :: forall a context m. (HasCommandLineOptions context a, MonadReader context m, MonadIO m) => m (CommandLineOptions a)
getCommandLineOptions :: forall a context (m :: * -> *).
(HasCommandLineOptions context a, MonadReader context m,
MonadIO m) =>
m (CommandLineOptions a)
getCommandLineOptions = forall (m :: * -> *) context (l :: Symbol) a.
(Monad m, HasLabel context l a, HasCallStack,
MonadReader context m) =>
Label l a -> m a
getContext forall {a}. Label "commandLineOptions" (CommandLineOptions a)
commandLineOptions
getUserCommandLineOptions :: (HasCommandLineOptions context a, MonadReader context m, MonadIO m) => m a
getUserCommandLineOptions :: forall context a (m :: * -> *).
(HasCommandLineOptions context a, MonadReader context m,
MonadIO m) =>
m a
getUserCommandLineOptions = forall a. CommandLineOptions a -> a
optUserOptions forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) context (l :: Symbol) a.
(Monad m, HasLabel context l a, HasCallStack,
MonadReader context m) =>
Label l a -> m a
getContext forall {a}. Label "commandLineOptions" (CommandLineOptions a)
commandLineOptions