1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00

Surface the precise heap through a State effect.

This commit is contained in:
Rob Rix 2019-11-04 13:35:07 -05:00
parent 8f50312be3
commit 327208eb15
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -22,7 +22,7 @@ newtype HeapC value m a = HeapC (StateC (IntMap.IntMap value) m a)
deriving (Applicative, Functor, Monad, Fail.MonadFail)
instance (Carrier sig m, Effect sig)
=> Carrier (Heap Precise value :+: sig) (HeapC value m) where
=> Carrier (Heap Precise value :+: State (IntMap.IntMap value) :+: sig) (HeapC value m) where
eff (L (Deref addr k)) = HeapC (gets (IntMap.lookup addr)) >>= k
eff (L (Assign addr value k)) = HeapC (modify (IntMap.insert addr value)) >> k
eff (R other) = HeapC (eff (R (handleCoercible other)))
eff (R other) = HeapC (eff (handleCoercible other))