1
1
mirror of https://github.com/github/semantic.git synced 2024-12-15 01:51:39 +03:00

Define CurrentFrame/Scope newtypes.

This commit is contained in:
Rob Rix 2018-12-06 11:46:34 -05:00
parent 74ca31af53
commit 04e2ca5321
2 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,7 @@ module Control.Abstract.Heap
, deref
, assign
, newFrame
, CurrentFrame(..)
, currentFrame
, withScopeAndFrame
, withLexicalScopeAndFrame
@ -122,6 +123,8 @@ putHeap = put
modifyHeap :: (Member (State (Heap address address value)) sig, Carrier sig m) => (Heap address address value -> Heap address address value) -> Evaluator term address value m ()
modifyHeap = modify
newtype CurrentFrame address = CurrentFrame { unCurrentFrame :: address }
-- | Retrieve the heap.
currentFrame :: ( Carrier sig m
, Member (Reader (address, address)) sig

View File

@ -10,6 +10,7 @@ module Control.Abstract.ScopeGraph
, ScopeError(..)
, Reference(..)
, EdgeLabel(..)
, CurrentScope(..)
, currentScope
, insertExportEdge
, insertImportEdge
@ -126,6 +127,8 @@ newScope edges = do
address <- alloc name
address <$ modify (ScopeGraph.newScope address edges)
newtype CurrentScope address = CurrentScope { unCurrentScope :: address }
currentScope :: forall address sig term value m. ( Member (Reader (address, address)) sig
, Carrier sig m
)