1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

extract a helper function

This commit is contained in:
Timothy Clem 2018-02-26 15:54:19 -08:00
parent bc364910ce
commit ab5e620991

View File

@ -54,8 +54,9 @@ load :: forall v term es.
, FreeVariables term
)
=> term -> Eff es v
load term = ask @(Linker (Evaluator v)) >>= maybe (fail ("cannot find " <> show name)) evalAndCache . linkerLookup name
load term = ask @(Linker (Evaluator v)) >>= maybe notFound evalAndCache . linkerLookup name
where name = moduleName term
notFound = fail ("cannot find " <> show name)
evalAndCache e = do
v <- raiseEmbedded (runEvaluator e)
modify @(Linker v) (linkerInsert name v)