1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Formatting those type sigs

This commit is contained in:
Timothy Clem 2018-03-02 14:38:01 -08:00
parent db879fe1f6
commit 515b9b64a1

View File

@ -37,13 +37,21 @@ newtype Evaluator v = Evaluator { runEvaluator :: Eff (Evaluating v) v }
-- | Require/import another term/file and return an Effect.
--
-- Looks up the term's name in the cache of evaluated modules first, returns a value if found, otherwise loads/evaluates the module.
require :: forall v es. (Members (Evaluating v) es, AbstractEnvironmentFor v) => ModuleName -> Eff es (EnvironmentFor v)
require :: forall v es.
( Members (Evaluating v) es
, AbstractEnvironmentFor v
)
=> ModuleName -> Eff es (EnvironmentFor v)
require name = get @(Linker (EnvironmentFor v)) >>= maybe (load name) pure . linkerLookup name
-- | Load another term/file and return an Effect.
--
-- Always loads/evaluates.
load :: forall v es. (Members (Evaluating v) es, AbstractEnvironmentFor v) => ModuleName -> Eff es (EnvironmentFor v)
load :: forall v es.
( Members (Evaluating v) es
, AbstractEnvironmentFor v
)
=> ModuleName -> Eff es (EnvironmentFor v)
load name = ask @(Linker (Evaluator v)) >>= maybe notFound evalAndCache . linkerLookup name
where notFound = fail ("cannot find " <> show name)
evalAndCache e = do