napkin-0.5.12
Copyright(c) Soostone Inc 2020
LicenseAllRightsReserved
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Napkin.Spec.Yaml.Interpret

Description

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

Documentation

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), Show (DbBackendOptions backend), ToJSON (DbBackendOptions backend), Eq (BackendTableMeta backend), Show (BackendTableMeta backend), RunBackendEffect backend, RunBackendConn backend, Show (BackendTableMeta backend), Show (BackendViewMeta backend), Show (BackendMaterializedViewMeta backend)) #

loadYamlFile :: forall m a. MonadIO m => SpecFileWithOverrides -> (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 NapkinError a) #

loadYamlFile' :: forall m a. (MonadError NapkinError m, MonadIO m) => SpecFileWithOverrides -> (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. Monad 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 Text a) #

loadYaml' :: forall m a. Monad m => Value -> Maybe Patch -> (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 Text a) #

interpretYamlToSpecImpl :: forall bk. (ReifiesBackend bk, ToDbBackend bk, Typeable 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.

interpretTable :: forall 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.