diff options
Diffstat (limited to 'compiler/main/Packages.hs')
-rw-r--r-- | compiler/main/Packages.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index fdf96708fb..ac4fae2449 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -79,6 +79,10 @@ import Data.Set (Set) #if __GLASGOW_HASKELL__ < 709 import Data.Monoid hiding ((<>)) #endif +#if __GLASGOW_HASKELL__ > 710 +import Data.Semigroup ( Semigroup ) +import qualified Data.Semigroup as Semigroup +#endif import qualified Data.Map as Map import qualified FiniteMap as Map import qualified Data.Set as Set @@ -191,6 +195,18 @@ fromReexportedModules False pkg = ModOrigin Nothing [] [pkg] False fromFlag :: ModuleOrigin fromFlag = ModOrigin Nothing [] [] True +#if __GLASGOW_HASKELL__ > 710 +instance Semigroup ModuleOrigin where + ModOrigin e res rhs f <> ModOrigin e' res' rhs' f' = + ModOrigin (g e e') (res ++ res') (rhs ++ rhs') (f || f') + where g (Just b) (Just b') + | b == b' = Just b + | otherwise = panic "ModOrigin: package both exposed/hidden" + g Nothing x = x + g x Nothing = x + _x <> _y = panic "ModOrigin: hidden module redefined" +#endif + instance Monoid ModuleOrigin where mempty = ModOrigin Nothing [] [] False mappend (ModOrigin e res rhs f) (ModOrigin e' res' rhs' f') = |