From 04e2ca5321d51e8a22e0095b0af15fae24c03555 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 6 Dec 2018 11:46:34 -0500 Subject: [PATCH] Define CurrentFrame/Scope newtypes. --- src/Control/Abstract/Heap.hs | 3 +++ src/Control/Abstract/ScopeGraph.hs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Control/Abstract/Heap.hs b/src/Control/Abstract/Heap.hs index 92b3779cc..9641c47fe 100644 --- a/src/Control/Abstract/Heap.hs +++ b/src/Control/Abstract/Heap.hs @@ -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 diff --git a/src/Control/Abstract/ScopeGraph.hs b/src/Control/Abstract/ScopeGraph.hs index 51fd32806..9a97bc939 100644 --- a/src/Control/Abstract/ScopeGraph.hs +++ b/src/Control/Abstract/ScopeGraph.hs @@ -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 )