From 1f0bc214e697750cb56e8d973df4448a41dc22ef Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 6 May 2018 16:00:55 -0400 Subject: [PATCH] Run unspecialized errors with a specialized handler. --- src/Data/Abstract/Evaluatable.hs | 4 ++++ src/Semantic/Util.hs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Data/Abstract/Evaluatable.hs b/src/Data/Abstract/Evaluatable.hs index 55dd585cd..6678f4df4 100644 --- a/src/Data/Abstract/Evaluatable.hs +++ b/src/Data/Abstract/Evaluatable.hs @@ -3,6 +3,7 @@ module Data.Abstract.Evaluatable ( module X , Evaluatable(..) , Unspecialized(..) +, runUnspecialized , EvalError(..) , LoadError(..) , runLoadError @@ -183,6 +184,9 @@ deriving instance Show (Unspecialized a b) instance Show1 (Unspecialized a) where liftShowsPrec _ _ = showsPrec +runUnspecialized :: Evaluator location term value (Resumable (Unspecialized value) ': effects) a -> Evaluator location term value effects (Either (SomeExc (Unspecialized value)) a) +runUnspecialized = raiseHandler runError + -- Instances diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index b5f93c4d5..00cbe1bb6 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -36,7 +36,7 @@ justEvaluating . evaluating . runLoadError . erroring @(ValueError Precise (Value Precise)) - . erroring @(Unspecialized (Value Precise)) + . runUnspecialized . erroring @ResolutionError . erroring @(EvalError (Value Precise)) . runAddressError @@ -57,7 +57,7 @@ checking . evaluating . providingLiveSet . runLoadError - . erroring @(Unspecialized (Type Monovariant)) + . runUnspecialized . erroring @ResolutionError . erroring @(EvalError (Type Monovariant)) . runAddressError