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

Commit 16b1442

Browse files
committed
Simplify deref slightly.
1 parent 0c10686 commit 16b1442

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

semantic-core/src/Analysis/ScopeGraph.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Control.Effect.Carrier
1313
import Control.Effect.Fresh
1414
import Control.Effect.Reader
1515
import Control.Effect.State
16+
import Control.Monad ((>=>))
1617
import qualified Data.Core as Core
1718
import Data.File
1819
import Data.Foldable (fold)
@@ -75,7 +76,7 @@ scopeGraphAnalysis = Analysis{..}
7576
loc <- ask @Loc
7677
local (Map.insert name loc) m
7778
lookupEnv = pure . Just
78-
deref addr = gets (Map.lookup addr) >>= maybe (pure Nothing) (foldMapA (pure . Just)) . nonEmpty . maybe [] (Set.toList @ScopeGraph)
79+
deref addr = gets (Map.lookup addr >=> nonEmpty . Set.toList) >>= maybe (pure Nothing) (foldMapA (pure . Just))
7980
assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty))
8081
abstract eval name body = do
8182
addr <- alloc name

0 commit comments

Comments
 (0)