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

Correct the Monoid instance for ScopeGraph.

This commit is contained in:
Rob Rix 2019-07-29 15:51:52 -04:00
parent 3bf6cb61fd
commit 6cb9af299e
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,4 +1,4 @@
{-# LANGUAGE FlexibleContexts, GeneralizedNewtypeDeriving, OverloadedStrings, RankNTypes, RecordWildCards, TypeApplications, TypeOperators #-}
{-# LANGUAGE FlexibleContexts, OverloadedStrings, RankNTypes, RecordWildCards, TypeApplications, TypeOperators #-}
module Analysis.ScopeGraph
( ScopeGraph(..)
, Entry(..)
@ -34,11 +34,14 @@ data Entry = Entry
deriving (Eq, Ord, Show)
newtype ScopeGraph = ScopeGraph { unScopeGraph :: Map.Map Entry (Set.Set Entry) }
deriving (Eq, Monoid, Ord, Show)
deriving (Eq, Ord, Show)
instance Semigroup ScopeGraph where
ScopeGraph a <> ScopeGraph b = ScopeGraph (Map.unionWith (<>) a b)
instance Monoid ScopeGraph where
mempty = ScopeGraph Map.empty
scopeGraph
:: Ord term
=> (forall sig m