1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Define a monovariant Heap carrier.

This commit is contained in:
Rob Rix 2019-11-04 12:52:03 -05:00
parent 1b8dafcf33
commit a17a6825d3
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,6 +1,20 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Analysis.Carrier.Heap.Monovariant
( -- * Heap effect
module Analysis.Effect.Heap
( -- * Heap carrier
runHeap
, HeapC(..)
-- * Heap effect
, module Analysis.Effect.Heap
) where
import Analysis.Effect.Heap
import Control.Effect.State.Strict
import qualified Control.Monad.Fail as Fail
import qualified Data.Map as Map
import qualified Data.Set as Set
runHeap :: HeapC addr value m a -> m (Map.Map addr (Set.Set value), a)
runHeap (HeapC m) = runState Map.empty m
newtype HeapC addr value m a = HeapC (StateC (Map.Map addr (Set.Set value)) m a)
deriving (Applicative, Functor, Monad, Fail.MonadFail)