Skip to content

Instantly share code, notes, and snippets.

@chrisdone
Last active May 4, 2022 08:45
Show Gist options
  • Save chrisdone/f591ea7c1e078a61c9d4c5bb325a85d2 to your computer and use it in GitHub Desktop.
Save chrisdone/f591ea7c1e078a61c9d4c5bb325a85d2 to your computer and use it in GitHub Desktop.
Document cell-load pipeline
-- | Load a renamed cell.
resolveRenamedCell ::
Map Hash (Either LoadError LoadedExpression)
-> FillerEnv LoadError
-> IsRenamed (Expression Renamed)
-> RIO DocumentReader (Either LoadError (IsResolved (Expression Resolved)))
resolveRenamedCell globalTypes globalHashes isRenamed = do
hasConstraints <-
pure $
first LoadGenerateError $
generateRenamed
(fmap (fmap loadedExpressionScheme) globalTypes)
globalHashes
isRenamed?
ref <- RIO.newSomeRef 0
binds <- RIO.newSomeRef mempty
isSolved <-
fmap (first LoadSolveError) $
RIO.runRIO
SolveReader {glogfunc = mempty, counter = ref, binds}
(solveGenerated hasConstraints)?
isGeneralised <-
fmap (first LoadGeneraliseError) $
RIO.runRIO GeneraliseReader (generaliseSolved isSolved)?
isResolved <-
fmap (first LoadResolveError) $
RIO.runRIO ResolveReader (resolveGeneralised isGeneralised)?
pure (Right isResolved)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment