Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module to adapt our effect stack for use in Spec pipelines. Ideally, the Spec machinery would only use this module to access Effects related concerns.
Synopsis
- data ProgramDependenciesAndQueries = ProgramDependenciesAndQueries {
- dependencies :: Set (Ref Table)
- queriesCreate :: [Query]
- queriesUpdate :: Maybe [Query]
- loadedSqlQueries :: [(FilePath, Query)]
- programDependenciesAndQueries :: forall b m. (MonadIO m, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> Ref Table -> SpecProgram b -> m (Either NapkinEffectError ProgramDependenciesAndQueries)
- validateSpecProgram :: forall b m. (MonadIO m, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> Ref Table -> CustomValidator -> SpecProgram b -> m (Either NapkinEffectError AssertionLog)
- runProgramReal :: forall m b a t1 t2 t3 t4 t5 t6 t7 t8 tr ret. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, TemplateIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> BackendConn b -> Ref Table -> SpecProgram' b ret -> m (Either NapkinEffectError ret)
- runHookProgramReal :: forall b m a t1 t2 t3 t4 t5 t6 t7 t8 tr ret. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, TemplateIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> BackendConn b -> HookProgram' b ret -> m (Either NapkinEffectError (Either (NonEmpty AssertionEntry) ([AssertionEntry], ret)))
- interceptDiscoverDependencies :: (Members [SqlRead, SqlWrite, ExternalCreate, Input (Transformed ExtraDependencies), Input (Transformed HiddenDependencies)] r, r ~ (Reader DynamicMeta ': (ExternalCreate ': (SqlWrite ': (SqlRead ': rs))))) => Sem r a -> Sem r ((Set (Ref Table), [Query]), a)
- runTableEnv :: QueryTransformer -> TargetName -> Sem ([Input (Transformed TargetName), Input (Transformed HiddenDependencies), Input (Transformed ExtraDependencies), Reader QueryTransformer, Reader TargetName, Reader HiddenDependencies, Reader ExtraDependencies] ++ r) a -> Sem r a
- runSqlFake :: forall bk r a. (Members [Input (Transformed TargetName), Reader HiddenDependencies, Input RandomToken] r, IsBackendTableMeta bk) => TargetExists -> Sem (Reader DynamicMeta ': (ExternalCreate ': (SqlWrite ': (SqlRead ': r)))) a -> Sem r (IState, a)
- runSqlReal :: forall bk r a. _ => BackendConn bk -> RuntimeEnv -> Sem (Reader DynamicMeta ': (ExternalCreate ': (SqlWrite ': (SqlRead ': r)))) a -> Sem r a
- runSqlParsing :: forall b r m a. (ToDbBackend b, TemplateIO b m, Members [Embed m, SqlWrite, SqlRead, Log, Reader ExtraDependencies] r) => RuntimeEnv -> ExternMacros -> SQLDialect -> Maybe (Sem (SqlParse ': (SqlRender ': (Reader SQLDialect ': r))) a -> Sem (SqlParse ': (SqlRender ': (Reader SQLDialect ': r))) a) -> Sem (LoadQuery ': (LocalFile ': (Template ': (SqlParse ': (SqlRender ': (Reader SQLDialect ': r)))))) a -> Sem r a
- runCoreFake :: (Member (Embed m) r, MonadIO m) => Sem (Input RandomToken ': (Time ': (Log ': r))) a -> Sem r a
- runCoreReal :: (Member (Embed m) r, MonadIO m, Katip m) => Sem (Input RandomToken ': (Time ': (Log ': r))) a -> Sem r a
- runTransformedTargetName :: Members [Reader TargetName, Reader QueryTransformer] r => Sem (Input (Transformed TargetName) ': r) a -> Sem r a
- runTransformedExtraDependencies :: Members [Reader ExtraDependencies, Reader QueryTransformer] r => Sem (Input (Transformed ExtraDependencies) ': r) a -> Sem r a
- runTransformedHiddenDependencies :: Members [Reader HiddenDependencies, Reader QueryTransformer] r => Sem (Input (Transformed HiddenDependencies) ': r) a -> Sem r a
Documentation
data ProgramDependenciesAndQueries #
ProgramDependenciesAndQueries | |
|
programDependenciesAndQueries :: forall b m. (MonadIO m, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> Ref Table -> SpecProgram b -> m (Either NapkinEffectError ProgramDependenciesAndQueries) #
Merely extracts all detectable dependencies out of the program.
validateSpecProgram :: forall b m. (MonadIO m, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> Ref Table -> CustomValidator -> SpecProgram b -> m (Either NapkinEffectError AssertionLog) #
Do a dry run of the program to exercise any validations that may be present.
to follow. Perhaps we can have this step cache loaded SQL files, SQL parsing, resolutions, etc and that cache can be fed to the real run to avoid re-doing expensive operations in the effect stack.
runProgramReal :: forall m b a t1 t2 t3 t4 t5 t6 t7 t8 tr ret. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, TemplateIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> BackendConn b -> Ref Table -> SpecProgram' b ret -> m (Either NapkinEffectError ret) #
Actually executes the given program
runHookProgramReal :: forall b m a t1 t2 t3 t4 t5 t6 t7 t8 tr ret. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, TemplateIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> InterpretedSpecEnvironment -> BackendConn b -> HookProgram' b ret -> m (Either NapkinEffectError (Either (NonEmpty AssertionEntry) ([AssertionEntry], ret))) #
interceptDiscoverDependencies :: (Members [SqlRead, SqlWrite, ExternalCreate, Input (Transformed ExtraDependencies), Input (Transformed HiddenDependencies)] r, r ~ (Reader DynamicMeta ': (ExternalCreate ': (SqlWrite ': (SqlRead ': rs))))) => Sem r a -> Sem r ((Set (Ref Table), [Query]), a) #
runTableEnv :: QueryTransformer -> TargetName -> Sem ([Input (Transformed TargetName), Input (Transformed HiddenDependencies), Input (Transformed ExtraDependencies), Reader QueryTransformer, Reader TargetName, Reader HiddenDependencies, Reader ExtraDependencies] ++ r) a -> Sem r a #
runSqlFake :: forall bk r a. (Members [Input (Transformed TargetName), Reader HiddenDependencies, Input RandomToken] r, IsBackendTableMeta bk) => TargetExists -> Sem (Reader DynamicMeta ': (ExternalCreate ': (SqlWrite ': (SqlRead ': r)))) a -> Sem r (IState, a) #
runSqlReal :: forall bk r a. _ => BackendConn bk -> RuntimeEnv -> Sem (Reader DynamicMeta ': (ExternalCreate ': (SqlWrite ': (SqlRead ': r)))) a -> Sem r a #
runSqlParsing :: forall b r m a. (ToDbBackend b, TemplateIO b m, Members [Embed m, SqlWrite, SqlRead, Log, Reader ExtraDependencies] r) => RuntimeEnv -> ExternMacros -> SQLDialect -> Maybe (Sem (SqlParse ': (SqlRender ': (Reader SQLDialect ': r))) a -> Sem (SqlParse ': (SqlRender ': (Reader SQLDialect ': r))) a) -> Sem (LoadQuery ': (LocalFile ': (Template ': (SqlParse ': (SqlRender ': (Reader SQLDialect ': r)))))) a -> Sem r a #
runCoreFake :: (Member (Embed m) r, MonadIO m) => Sem (Input RandomToken ': (Time ': (Log ': r))) a -> Sem r a #
runCoreReal :: (Member (Embed m) r, MonadIO m, Katip m) => Sem (Input RandomToken ': (Time ': (Log ': r))) a -> Sem r a #
runTransformedTargetName :: Members [Reader TargetName, Reader QueryTransformer] r => Sem (Input (Transformed TargetName) ': r) a -> Sem r a #
runTransformedExtraDependencies :: Members [Reader ExtraDependencies, Reader QueryTransformer] r => Sem (Input (Transformed ExtraDependencies) ': r) a -> Sem r a #
runTransformedHiddenDependencies :: Members [Reader HiddenDependencies, Reader QueryTransformer] r => Sem (Input (Transformed HiddenDependencies) ': r) a -> Sem r a #