From ab5e620991988eaeeec3859bcaa6f740a236d793 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Mon, 26 Feb 2018 15:54:19 -0800 Subject: [PATCH] extract a helper function --- src/Analysis/Abstract/Evaluating.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Analysis/Abstract/Evaluating.hs b/src/Analysis/Abstract/Evaluating.hs index 5d8353be6..9813fead3 100644 --- a/src/Analysis/Abstract/Evaluating.hs +++ b/src/Analysis/Abstract/Evaluating.hs @@ -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)