mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Don’t allocate a pointless heap cell.
This commit is contained in:
parent
b8f7bb06db
commit
cb5b0fb2c4
@ -65,8 +65,8 @@ cacheTerm eval term = do
|
||||
result <- eval term
|
||||
result <$ modify (Map.insertWith (<>) term (Set.singleton (result :: a)))
|
||||
|
||||
runHeap :: name -> StateC (Heap name a) m b -> m (Heap name a, b)
|
||||
runHeap addr m = runState (Map.singleton addr Set.empty) m
|
||||
runHeap :: StateC (Heap name a) m b -> m (Heap name a, b)
|
||||
runHeap m = runState Map.empty m
|
||||
|
||||
-- | Fold a collection by mapping each element onto an 'Alternative' action.
|
||||
foldMapA :: (Alternative m, Foldable t) => (b -> m a) -> t b -> m a
|
||||
|
@ -52,7 +52,7 @@ importGraph :: [File (Term Core.Core User)] -> (Heap User Value, [File (Either (
|
||||
importGraph
|
||||
= run
|
||||
. runFresh
|
||||
. runHeap "__semantic_root"
|
||||
. runHeap
|
||||
. traverse runFile
|
||||
|
||||
runFile :: ( Carrier sig m
|
||||
|
@ -58,7 +58,7 @@ scopeGraph :: [File (Term Core.Core User)] -> (Heap User Value, [File (Either (L
|
||||
scopeGraph
|
||||
= run
|
||||
. runFresh
|
||||
. runHeap "__semantic_root"
|
||||
. runHeap
|
||||
. traverse runFile
|
||||
|
||||
runFile
|
||||
|
@ -90,7 +90,7 @@ typecheckingFlowInsensitive :: [File (Term Core.Core User)] -> (Heap User (Term
|
||||
typecheckingFlowInsensitive
|
||||
= run
|
||||
. runFresh
|
||||
. runHeap "__semantic_root"
|
||||
. runHeap
|
||||
. fmap (fmap (fmap (fmap generalize)))
|
||||
. traverse runFile
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user