1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Avoid allocating a useless cell.

This commit is contained in:
Rob Rix 2019-07-29 12:58:20 -04:00
parent 2c28e536e9
commit e9853c1a3f
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
3 changed files with 4 additions and 4 deletions

View File

@ -67,8 +67,8 @@ cacheTerm eval term = do
result <- eval term
result <$ modify (Cache . Map.insertWith (<>) term (Set.singleton (result :: a)) . unCache)
runHeap :: address -> StateC (Heap address a) m b -> m (Heap address a, b)
runHeap addr m = runState (Map.singleton addr Set.empty) m
runHeap :: StateC (Heap address a) m b -> m (Heap address 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

View File

@ -63,7 +63,7 @@ importGraph
importGraph eval
= run
. runFresh
. runHeap "__semantic_root"
. runHeap
. traverse (runFile eval)
runFile

View File

@ -103,7 +103,7 @@ typecheckingFlowInsensitive
typecheckingFlowInsensitive eval
= run
. runFresh
. runHeap "__semantic_root"
. runHeap
. fmap (fmap (fmap (fmap generalize)))
. traverse (runFile eval)