Copyright | (c) Soostone Inc 2020 |
---|---|
License | AllRightsReserved |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module should be seen as an interpreter that takes the YAML version of a spec and converts it to a proper, fully typed Spec value.
In a sense, it's also a bit of a typechecker: YAML versions are necessarily dynamically typed and there's the possibility of type mismatches.
Synopsis
- newtype YamlParseError = YamlParseError Text
- type LoadYamlConstraint backend drop t1 t2 t3 t4 t5 t6 t7 t8 t9 = (SpecBackend backend drop t1 t2 t3 t4 t5 t6 t7 t8 t9, Default (DbBackendOptions backend), ToJSON (DbBackendOptions backend), ToJSON (YamlBackendTableMeta backend), RunBackendEffect backend, RunBackendConn backend)
- loadYamlFile :: forall m a. (MonadThrow m, MonadIO m) => FilePath -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m (Either YamlParseError a)
- loadYamlFile' :: forall m. (MonadThrow m, MonadIO m) => FilePath -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m ExitCode) -> m ExitCode
- loadYamlFileThrow :: forall m a. (MonadThrow m, MonadIO m) => FilePath -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m a
- loadYamlBS :: forall m a. MonadThrow m => ByteString -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m (Either YamlParseError a)
- loadYaml' :: forall m a. MonadThrow m => Value -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m (Either YamlParseError a)
- interpretYamlToSpec :: forall bk. (ReifiesBackend bk, ToDbBackend bk, Typeable bk, IsBackendTableMeta bk) => InterpreterInstance -> YamlSpec bk -> ExceptT HaskellEvaluationError (Spec bk) ()
- data YamlSpecInterpretError
- displayYamlSpecInterpretError :: YamlSpecInterpretError -> Text
- interpretYamlToSpec' :: forall m b. (MonadIO m, ReifiesBackend b, ToDbBackend b, IsBackendTableMeta b, Typeable b, Katip m) => InterpreterInstance -> YamlSpec b -> SpecMetaArgs -> ExceptT YamlSpecInterpretError m (InterpretedSpec b)
- interpretTable :: forall bk. (IsBackendTableMeta bk, ReifiesBackend bk, ToDbBackend bk, Typeable bk) => InterpreterInstance -> Ref Table -> YamlTableSpec bk -> ExceptT HaskellEvaluationError (Spec bk) ()
- interpretSpec :: forall b. (ReifiesBackend b, Typeable b) => InterpreterInstance -> Typed (Spec b ()) ModuleFunction -> ExceptT HaskellEvaluationError (Spec b) ()
- evalHsFun :: forall m b. (Typeable b, MonadIO m) => InterpreterInstance -> Typed b ModuleFunction -> ExceptT HaskellEvaluationError m b
Documentation
newtype YamlParseError #
Instances
Eq YamlParseError # | |
Defined in Napkin.Spec.Yaml.Interpret (==) :: YamlParseError -> YamlParseError -> Bool # (/=) :: YamlParseError -> YamlParseError -> Bool # | |
Show YamlParseError # | |
Defined in Napkin.Spec.Yaml.Interpret showsPrec :: Int -> YamlParseError -> ShowS # show :: YamlParseError -> String # showList :: [YamlParseError] -> ShowS # | |
Exception YamlParseError # | |
Defined in Napkin.Spec.Yaml.Interpret |
type LoadYamlConstraint backend drop t1 t2 t3 t4 t5 t6 t7 t8 t9 = (SpecBackend backend drop t1 t2 t3 t4 t5 t6 t7 t8 t9, Default (DbBackendOptions backend), ToJSON (DbBackendOptions backend), ToJSON (YamlBackendTableMeta backend), RunBackendEffect backend, RunBackendConn backend) #
loadYamlFile :: forall m a. (MonadThrow m, MonadIO m) => FilePath -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m (Either YamlParseError a) #
loadYamlFile' :: forall m. (MonadThrow m, MonadIO m) => FilePath -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m ExitCode) -> m ExitCode #
loadYamlFileThrow :: forall m a. (MonadThrow m, MonadIO m) => FilePath -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m a #
loadYamlBS :: forall m a. MonadThrow m => ByteString -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m (Either YamlParseError a) #
loadYaml' :: forall m a. MonadThrow m => Value -> (forall b drop t1 t2 t3 t4 t5 t6 t7 t8 t9. LoadYamlConstraint b drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => b -> YamlSpec b -> m a) -> m (Either YamlParseError a) #
interpretYamlToSpec :: forall bk. (ReifiesBackend bk, ToDbBackend bk, Typeable bk, IsBackendTableMeta bk) => InterpreterInstance -> YamlSpec bk -> ExceptT HaskellEvaluationError (Spec bk) () #
The main entry point interpreting a given YAML spec file as a
Spec
value ready to run via executeSpec
This function is intended to unroll/interpet as much as possible to get the spec in its final state ready to be actually run.
data YamlSpecInterpretError #
interpretYamlToSpec' :: forall m b. (MonadIO m, ReifiesBackend b, ToDbBackend b, IsBackendTableMeta b, Typeable b, Katip m) => InterpreterInstance -> YamlSpec b -> SpecMetaArgs -> ExceptT YamlSpecInterpretError m (InterpretedSpec b) #
interpretTable :: forall bk. (IsBackendTableMeta bk, ReifiesBackend bk, ToDbBackend bk, Typeable bk) => InterpreterInstance -> Ref Table -> YamlTableSpec bk -> ExceptT HaskellEvaluationError (Spec bk) () #
Main entry point for fully interpreting a given table's entry in the YAML file.
interpretSpec :: forall b. (ReifiesBackend b, Typeable b) => InterpreterInstance -> Typed (Spec b ()) ModuleFunction -> ExceptT HaskellEvaluationError (Spec b) () #
evalHsFun :: forall m b. (Typeable b, MonadIO m) => InterpreterInstance -> Typed b ModuleFunction -> ExceptT HaskellEvaluationError m b #