1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Simplify deref slightly.

This commit is contained in:
Rob Rix 2019-07-26 15:35:43 -04:00
parent 0c106865f7
commit 16b1442b4b
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -13,6 +13,7 @@ import Control.Effect.Carrier
import Control.Effect.Fresh
import Control.Effect.Reader
import Control.Effect.State
import Control.Monad ((>=>))
import qualified Data.Core as Core
import Data.File
import Data.Foldable (fold)
@ -75,7 +76,7 @@ scopeGraphAnalysis = Analysis{..}
loc <- ask @Loc
local (Map.insert name loc) m
lookupEnv = pure . Just
deref addr = gets (Map.lookup addr) >>= maybe (pure Nothing) (foldMapA (pure . Just)) . nonEmpty . maybe [] (Set.toList @ScopeGraph)
deref addr = gets (Map.lookup addr >=> nonEmpty . Set.toList) >>= maybe (pure Nothing) (foldMapA (pure . Just))
assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty))
abstract eval name body = do
addr <- alloc name