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, ParseSQL b, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> Ref Table -> SpecProgram b -> m (Either NapkinEffectError ProgramDependenciesAndQueries)
- validateSpecProgram :: forall b m. (MonadIO m, ParseSQL b, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> Ref Table -> CustomValidator -> SpecProgram b -> SpecMetaArgs -> m (Either NapkinEffectError AssertionLog)
- runProgramReal :: forall m b a t1 t2 t3 t4 t5 t6 t7 t8 tr. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, SqlParseIO b, LocalFileIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> BackendConn b -> SpecMetaArgs -> Ref Table -> SpecProgram b -> m (Either NapkinEffectError ())
- runHookProgramReal :: forall b m a t1 t2 t3 t4 t5 t6 t7 t8 tr. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, SqlParseIO b, LocalFileIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> BackendConn b -> SpecMetaArgs -> HookProgram b -> m (Either NapkinEffectError (Either (NonEmpty AssertionEntry) [AssertionEntry]))
- 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 :: 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. (SqlParseIO b, LocalFileIO b m, Members [Embed m, SqlWrite, SqlRead, Log, Reader ExtraDependencies] r) => RuntimeEnv -> ExternMacros -> Maybe (Sem (SqlParse ': (SqlRender ': r)) a -> Sem (SqlParse ': (SqlRender ': r)) a) -> Sem (LocalFile ': (SqlParse ': (SqlRender ': 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, ParseSQL b, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> Ref Table -> SpecProgram b -> m (Either NapkinEffectError ProgramDependenciesAndQueries) #
Merely extracts all detectable dependencies out of the program.
validateSpecProgram :: forall b m. (MonadIO m, ParseSQL b, ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> Ref Table -> CustomValidator -> SpecProgram b -> SpecMetaArgs -> 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. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, SqlParseIO b, LocalFileIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> BackendConn b -> SpecMetaArgs -> Ref Table -> SpecProgram b -> m (Either NapkinEffectError ()) #
Actually executes the given program
runHookProgramReal :: forall b m a t1 t2 t3 t4 t5 t6 t7 t8 tr. (SqlWriteIO m b a t1 t2 t3 t4 t5 t6 t7 t8, SqlReadIO m b a tr, ExternalCreateIO m, SqlParseIO b, LocalFileIO b m, m ~ ComboT IO, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> BackendConn b -> SpecMetaArgs -> HookProgram b -> m (Either NapkinEffectError (Either (NonEmpty AssertionEntry) [AssertionEntry])) #
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 :: 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. (SqlParseIO b, LocalFileIO b m, Members [Embed m, SqlWrite, SqlRead, Log, Reader ExtraDependencies] r) => RuntimeEnv -> ExternMacros -> Maybe (Sem (SqlParse ': (SqlRender ': r)) a -> Sem (SqlParse ': (SqlRender ': r)) a) -> Sem (LocalFile ': (SqlParse ': (SqlRender ': 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 #