Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit cb5b0fb

Browse files
committed
Don’t allocate a pointless heap cell.
1 parent b8f7bb0 commit cb5b0fb

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

semantic-core/src/Analysis/FlowInsensitive.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ cacheTerm eval term = do
6565
result <- eval term
6666
result <$ modify (Map.insertWith (<>) term (Set.singleton (result :: a)))
6767

68-
runHeap :: name -> StateC (Heap name a) m b -> m (Heap name a, b)
69-
runHeap addr m = runState (Map.singleton addr Set.empty) m
68+
runHeap :: StateC (Heap name a) m b -> m (Heap name a, b)
69+
runHeap m = runState Map.empty m
7070

7171
-- | Fold a collection by mapping each element onto an 'Alternative' action.
7272
foldMapA :: (Alternative m, Foldable t) => (b -> m a) -> t b -> m a

semantic-core/src/Analysis/ImportGraph.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ importGraph :: [File (Term Core.Core User)] -> (Heap User Value, [File (Either (
5252
importGraph
5353
= run
5454
. runFresh
55-
. runHeap "__semantic_root"
55+
. runHeap
5656
. traverse runFile
5757

5858
runFile :: ( Carrier sig m

semantic-core/src/Analysis/ScopeGraph.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ scopeGraph :: [File (Term Core.Core User)] -> (Heap User Value, [File (Either (L
5858
scopeGraph
5959
= run
6060
. runFresh
61-
. runHeap "__semantic_root"
61+
. runHeap
6262
. traverse runFile
6363

6464
runFile

semantic-core/src/Analysis/Typecheck.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ typecheckingFlowInsensitive :: [File (Term Core.Core User)] -> (Heap User (Term
9090
typecheckingFlowInsensitive
9191
= run
9292
. runFresh
93-
. runHeap "__semantic_root"
93+
. runHeap
9494
. fmap (fmap (fmap (fmap generalize)))
9595
. traverse runFile
9696

0 commit comments

Comments
 (0)