diff --git a/src/Data/Abstract/ScopeGraph.hs b/src/Data/Abstract/ScopeGraph.hs index 9e3646634..1031773e0 100644 --- a/src/Data/Abstract/ScopeGraph.hs +++ b/src/Data/Abstract/ScopeGraph.hs @@ -266,7 +266,8 @@ scopeOfDeclaration Declaration{..} g@(ScopeGraph graph) = go (Map.keys graph) associatedScope :: Ord scope => Declaration -> ScopeGraph scope -> Maybe scope associatedScope Declaration{..} g@(ScopeGraph graph) = go (Map.keys graph) where - go = foldr (\ scope -> ((lookupDeclaration unDeclaration scope g >>= dataAssociatedScope . fst) <|>)) Nothing + go = foldr lookupAssociatedScope Nothing + lookupAssociatedScope scope = ((lookupDeclaration unDeclaration scope g >>= dataAssociatedScope . fst) <|>) newtype Reference = Reference { unReference :: Name } deriving (Eq, Ord, Show, Generic, NFData)