mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +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 <- eval term
|
||||||
result <$ modify (Map.insertWith (<>) term (Set.singleton (result :: a)))
|
result <$ modify (Map.insertWith (<>) term (Set.singleton (result :: a)))
|
||||||
|
|
||||||
runHeap :: name -> StateC (Heap name a) m b -> m (Heap name a, b)
|
runHeap :: StateC (Heap name a) m b -> m (Heap name a, b)
|
||||||
runHeap addr m = runState (Map.singleton addr Set.empty) m
|
runHeap m = runState Map.empty m
|
||||||
|
|
||||||
-- | Fold a collection by mapping each element onto an 'Alternative' action.
|
-- | Fold a collection by mapping each element onto an 'Alternative' action.
|
||||||
foldMapA :: (Alternative m, Foldable t) => (b -> m a) -> t b -> m a
|
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
|
importGraph
|
||||||
= run
|
= run
|
||||||
. runFresh
|
. runFresh
|
||||||
. runHeap "__semantic_root"
|
. runHeap
|
||||||
. traverse runFile
|
. traverse runFile
|
||||||
|
|
||||||
runFile :: ( Carrier sig m
|
runFile :: ( Carrier sig m
|
||||||
|
@ -58,7 +58,7 @@ scopeGraph :: [File (Term Core.Core User)] -> (Heap User Value, [File (Either (L
|
|||||||
scopeGraph
|
scopeGraph
|
||||||
= run
|
= run
|
||||||
. runFresh
|
. runFresh
|
||||||
. runHeap "__semantic_root"
|
. runHeap
|
||||||
. traverse runFile
|
. traverse runFile
|
||||||
|
|
||||||
runFile
|
runFile
|
||||||
|
@ -90,7 +90,7 @@ typecheckingFlowInsensitive :: [File (Term Core.Core User)] -> (Heap User (Term
|
|||||||
typecheckingFlowInsensitive
|
typecheckingFlowInsensitive
|
||||||
= run
|
= run
|
||||||
. runFresh
|
. runFresh
|
||||||
. runHeap "__semantic_root"
|
. runHeap
|
||||||
. fmap (fmap (fmap (fmap generalize)))
|
. fmap (fmap (fmap (fmap generalize)))
|
||||||
. traverse runFile
|
. traverse runFile
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user