1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 05:11:44 +03:00

Simplify a bit with *** rather than &&&

This commit is contained in:
Rick Winfrey 2018-12-14 12:01:34 -08:00
parent c6766b96a1
commit eb83f9478d

View File

@ -221,14 +221,14 @@ insertDeclarationScope :: Ord scopeAddress => Declaration -> scopeAddress -> sco
insertDeclarationScope decl@Declaration{..} associatedScopeAddress scopeAddress g = fromMaybe g $ do
declScopeAddress <- pathDeclarationScope scopeAddress =<< lookupScopePath unDeclaration scopeAddress g
scope <- lookupScope declScopeAddress g
(declData, position) <- (fst &&& unPosition . snd) <$> lookupDeclaration unDeclaration declScopeAddress g
(declData, position) <- (id *** unPosition) <$> lookupDeclaration unDeclaration declScopeAddress g
pure $ insertScope declScopeAddress (scope { declarations = Seq.adjust (const (Data decl (dataRelation declData) (dataSpan declData) (Just associatedScopeAddress))) position (declarations scope) }) g
-- | Insert a declaration span into the declaration in the scope graph.
insertDeclarationSpan :: Ord scopeAddress => Declaration -> Span -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress
insertDeclarationSpan decl@Declaration{..} span g = fromMaybe g $ do
declScopeAddress <- scopeOfDeclaration decl g
(declData, position) <- (fst &&& unPosition . snd) <$> lookupDeclaration unDeclaration declScopeAddress g
(declData, position) <- (id *** unPosition) <$> lookupDeclaration unDeclaration declScopeAddress g
scope <- lookupScope declScopeAddress g
pure $ insertScope declScopeAddress (scope { declarations = Seq.adjust (const (Data decl (dataRelation declData) span (dataAssociatedScope declData))) position (declarations scope) }) g