mirror of
https://github.com/github/semantic.git
synced 2024-11-28 18:23:44 +03:00
Add BadLoads
This commit is contained in:
parent
9f51129314
commit
9883948abd
@ -17,6 +17,7 @@ library
|
||||
-- Analyses & term annotations
|
||||
Analysis.Abstract.BadAddresses
|
||||
, Analysis.Abstract.BadModuleResolutions
|
||||
, Analysis.Abstract.BadLoads
|
||||
, Analysis.Abstract.BadSyntax
|
||||
, Analysis.Abstract.BadValues
|
||||
, Analysis.Abstract.BadVariables
|
||||
|
24
src/Analysis/Abstract/BadLoads.hs
Normal file
24
src/Analysis/Abstract/BadLoads.hs
Normal file
@ -0,0 +1,24 @@
|
||||
{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, TypeFamilies, TypeOperators, UndecidableInstances #-}
|
||||
{-# OPTIONS_GHC -Wno-redundant-constraints #-} -- For the Interpreter instance’s MonadEvaluator constraint
|
||||
module Analysis.Abstract.BadLoads where
|
||||
|
||||
import Control.Abstract.Analysis
|
||||
import Data.Abstract.Evaluatable
|
||||
import Prologue
|
||||
|
||||
newtype BadLoads m (effects :: [* -> *]) a = BadLoads { runBadLoads :: m effects a }
|
||||
deriving (Alternative, Applicative, Functor, Effectful, Monad)
|
||||
|
||||
deriving instance MonadEvaluator location term value effects m => MonadEvaluator location term value effects (BadLoads m)
|
||||
deriving instance MonadAnalysis location term value effects m => MonadAnalysis location term value effects (BadLoads m)
|
||||
|
||||
instance ( Interpreter m effects
|
||||
, MonadEvaluator location term value effects m
|
||||
)
|
||||
=> Interpreter (BadLoads m) (Resumable (LoadError term) ': effects) where
|
||||
type Result (BadLoads m) (Resumable (LoadError term) ': effects) result = Result m effects result
|
||||
interpret
|
||||
= interpret
|
||||
. runBadLoads
|
||||
. raiseHandler (relay pure (\ (Resumable err) yield -> traceM ("LoadError:" <> show err) *> case err of
|
||||
LoadError _ -> yield []))
|
Loading…
Reference in New Issue
Block a user