From 69e0e13b1f20abb783ef10a672527f2f69b5647e Mon Sep 17 00:00:00 2001 From: joshvera Date: Fri, 14 Dec 2018 17:07:13 -0500 Subject: [PATCH] Factor out lambda --- src/Data/Abstract/ScopeGraph.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)