Add Semigroup instance for 'Max' monoid
Otherwise ghc 8.4 will complain since Semigroup became a superclass of Monoid.pull/132/head
parent
b43ee43220
commit
e9689394b1
|
@ -11,6 +11,7 @@ import qualified Language.Haskell.GHC.ExactPrint.Annotate as ExactPrint.Annotate
|
|||
import qualified Language.Haskell.GHC.ExactPrint.Types as ExactPrint.Types
|
||||
import qualified Language.Haskell.GHC.ExactPrint.Parsers as ExactPrint.Parsers
|
||||
import qualified Data.Map as Map
|
||||
import qualified Data.Monoid
|
||||
|
||||
import Text.Read (Read(..))
|
||||
import qualified Text.ParserCombinators.ReadP as ReadP
|
||||
|
@ -148,7 +149,7 @@ mainCmdParser helpDesc = do
|
|||
, PP.text "inplace: override respective input file (without backup!)"
|
||||
]
|
||||
)
|
||||
<> flagDefault Display
|
||||
Data.Monoid.<> flagDefault Display
|
||||
)
|
||||
inputParams <- addParamNoFlagStrings "PATH" (paramHelpStr "paths to input/inout haskell source files")
|
||||
reorderStop
|
||||
|
|
|
@ -255,14 +255,16 @@ import Debug.Trace as E ( trace
|
|||
import Foreign.ForeignPtr as E ( ForeignPtr
|
||||
)
|
||||
|
||||
import Data.Monoid as E ( (<>)
|
||||
, mconcat
|
||||
import Data.Monoid as E ( mconcat
|
||||
, Monoid (..)
|
||||
)
|
||||
|
||||
import Data.Bifunctor as E ( bimap )
|
||||
import Data.Functor as E ( (<$), ($>) )
|
||||
import Data.Function as E ( (&) )
|
||||
import Data.Semigroup as E ( (<>)
|
||||
, Semigroup(..)
|
||||
)
|
||||
import System.IO as E ( hFlush
|
||||
, stdout
|
||||
)
|
||||
|
|
|
@ -84,9 +84,12 @@ fromOptionIdentity x y =
|
|||
newtype Max a = Max { getMax :: a }
|
||||
deriving (Eq, Ord, Show, Bounded, Num)
|
||||
|
||||
instance (Num a, Ord a) => Semigroup (Max a) where
|
||||
(<>) = Data.Coerce.coerce (max :: a -> a -> a)
|
||||
|
||||
instance (Num a, Ord a) => Monoid (Max a) where
|
||||
mempty = Max 0
|
||||
mappend = Data.Coerce.coerce (max :: a -> a -> a)
|
||||
mappend = (<>)
|
||||
|
||||
newtype ShowIsId = ShowIsId String deriving Data
|
||||
|
||||
|
|
Loading…
Reference in New Issue