1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

Define an Interpreter instance for Collecting.

This commit is contained in:
Rob Rix 2018-04-24 18:55:38 -04:00
parent b4dd5cffc8
commit ff3ba0fa9d

View File

@ -1,4 +1,4 @@
{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-}
module Analysis.Abstract.Collecting
( Collecting
) where
@ -76,3 +76,10 @@ reachable roots heap = go mempty roots
Just (a, as) -> go (liveInsert a seen) (case heapLookupAll a heap of
Just values -> liveDifference (foldr ((<>) . valueRoots) mempty values <> as) seen
_ -> seen)
instance ( Interpreter effects result rest m
, Ord location
)
=> Interpreter (Reader (Live location value) ': effects) result rest (Collecting m) where
interpret = interpret . raise @m . flip runReader mempty . lower