From 587c0781714137ed9320d00e088e40a383b1d245 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 26 Mar 2018 10:28:14 -0400 Subject: [PATCH] Silence unspecialized exceptions. --- src/Analysis/Abstract/Quiet.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Analysis/Abstract/Quiet.hs b/src/Analysis/Abstract/Quiet.hs index 54a6d6185..e2d0d3127 100644 --- a/src/Analysis/Abstract/Quiet.hs +++ b/src/Analysis/Abstract/Quiet.hs @@ -1,7 +1,9 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies #-} +{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeApplications, TypeFamilies #-} module Analysis.Abstract.Quiet where import Control.Abstract.Analysis +import Control.Monad.Effect.Resumable +import Data.Abstract.Evaluatable import Prologue newtype Quietly m term value (effects :: [* -> *]) a = Quietly (m term value effects a) @@ -13,10 +15,14 @@ deriving instance MonadHeap value (m term value effects) => MonadHeap value (Qui deriving instance MonadModuleTable term value (m term value effects) => MonadModuleTable term value (Quietly m term value effects) deriving instance MonadEvaluator term value (m term value effects) => MonadEvaluator term value (Quietly m term value effects) -instance MonadAnalysis term value (m term value effects) +instance ( Effectful (m term value) + , Member (Resumable (Unspecialized value)) effects + , MonadAnalysis term value (m term value effects) + , MonadValue value (Quietly m term value effects) + ) => MonadAnalysis term value (Quietly m term value effects) where type RequiredEffects term value (Quietly m term value effects) = RequiredEffects term value (m term value effects) - analyzeTerm = liftAnalyze analyzeTerm + analyzeTerm eval term = resumeException @(Unspecialized value) (liftAnalyze analyzeTerm eval term) (\yield (Unspecialized _) -> unit >>= yield) analyzeModule = liftAnalyze analyzeModule