From 283284e91ed9be4c77a2f941b1d4580c9dfbc339 Mon Sep 17 00:00:00 2001 From: joshvera Date: Fri, 7 Dec 2018 17:57:20 -0500 Subject: [PATCH] Add ConstructorError and ScopedEnvError --- src/Data/Abstract/Evaluatable.hs | 20 ++++++++++++-------- src/Semantic/Graph.hs | 18 ++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/Data/Abstract/Evaluatable.hs b/src/Data/Abstract/Evaluatable.hs index 175ea4de9..3c6f772be 100644 --- a/src/Data/Abstract/Evaluatable.hs +++ b/src/Data/Abstract/Evaluatable.hs @@ -171,21 +171,25 @@ data EvalError address value return where NoNameError :: EvalError address value Name RationalFormatError :: Text -> EvalError address value Rational ReferenceError :: value -> Name -> EvalError address value (ValueRef address value) + ConstructorError :: Name -> EvalError address value address + ScopedEnvError :: value -> EvalError address value address deriving instance (Eq address, Eq value) => Eq (EvalError address value return) deriving instance (Show address, Show value) => Show (EvalError address value return) instance NFData value => NFData1 (EvalError address value) where liftRnf _ x = case x of - DerefError v -> rnf v - DefaultExportError -> () - ExportError p n -> rnf p `seq` rnf n - FloatFormatError i -> rnf i - IntegerFormatError i -> rnf i - NoNameError -> () - RationalFormatError i -> rnf i - ReferenceError v n -> rnf v `seq` rnf n + DerefError v -> rnf v + DefaultExportError -> () + ExportError p n -> rnf p `seq` rnf n + FloatFormatError i -> rnf i + IntegerFormatError i -> rnf i + NoNameError -> () + RationalFormatError i -> rnf i + ReferenceError v n -> rnf v `seq` rnf n QualifiedImportError i -> rnf i + ConstructorError n -> rnf n + ScopedEnvError v -> rnf v instance (NFData value, NFData return) => NFData (EvalError address value return) where rnf = liftRnf rnf diff --git a/src/Semantic/Graph.hs b/src/Semantic/Graph.hs index d8be24b8e..6a8c1cf21 100644 --- a/src/Semantic/Graph.hs +++ b/src/Semantic/Graph.hs @@ -366,15 +366,17 @@ resumingEvalError :: ( Carrier sig m m)) a -> Evaluator term address value m a resumingEvalError = runEvalErrorWith (\ baseError -> traceError "EvalError" baseError *> case baseErrorException baseError of + ConstructorError _ -> pure hole + ScopedEnvError _ -> pure hole QualifiedImportError{} -> pure hole - DerefError{} -> pure hole - ReferenceError{} -> pure hole - DefaultExportError{} -> pure () - ExportError{} -> pure () - IntegerFormatError{} -> pure 0 - FloatFormatError{} -> pure 0 - RationalFormatError{} -> pure 0 - NoNameError -> gensym) + DerefError{} -> pure hole + ReferenceError{} -> pure hole + DefaultExportError{} -> pure () + ExportError{} -> pure () + IntegerFormatError{} -> pure 0 + FloatFormatError{} -> pure 0 + RationalFormatError{} -> pure 0 + NoNameError -> gensym) resumingUnspecialized :: ( AbstractHole value , Carrier sig m