File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
lib/Language/Haskell/Stylish/Step Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ import Data.Char (toLower)
2222import Data.List (intercalate , sortBy )
2323import qualified Data.Map as M
2424import Data.Maybe (isJust , maybeToList )
25- import Data.Monoid ((<>) )
2625import Data.Ord (comparing )
2726import qualified Data.Set as S
27+ import Data.Semigroup (Semigroup ((<>) ))
2828import qualified Language.Haskell.Exts as H
2929
3030
@@ -168,10 +168,13 @@ data ImportPortion l
168168 = ImportSome [H. CName l ] -- ^ @A(x, y, z)@
169169 | ImportAll -- ^ @A(..)@
170170
171+ instance Ord l => Semigroup (ImportPortion l ) where
172+ ImportSome a <> ImportSome b = ImportSome (setUnion a b)
173+ _ <> _ = ImportAll
174+
171175instance Ord l => Monoid (ImportPortion l ) where
172176 mempty = ImportSome []
173- mappend (ImportSome a) (ImportSome b) = ImportSome (setUnion a b)
174- mappend _ _ = ImportAll
177+ mappend = (<>)
175178
176179-- | O(n log n) union.
177180setUnion :: Ord a => [a ] -> [a ] -> [a ]
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ Library
5757 file-embed >= 0.0.10 && < 0.1 ,
5858 haskell-src-exts >= 1.18 && < 1.21 ,
5959 mtl >= 2.0 && < 2.3 ,
60+ semigroups >= 0.18 && < 0.19 ,
6061 syb >= 0.3 && < 0.8 ,
6162 yaml >= 0.7 && < 0.9
6263
You can’t perform that action at this time.
0 commit comments