diff options
Diffstat (limited to 'Types')
-rw-r--r-- | Types/DesktopNotify.hs | 7 | ||||
-rw-r--r-- | Types/Difference.hs | 11 | ||||
-rw-r--r-- | Types/Test.hs | 9 |
3 files changed, 18 insertions, 9 deletions
diff --git a/Types/DesktopNotify.hs b/Types/DesktopNotify.hs index e6df05ab1..0b2da9377 100644 --- a/Types/DesktopNotify.hs +++ b/Types/DesktopNotify.hs @@ -1,6 +1,7 @@ {- git-annex DesktopNotify type - - Copyright 2014 Joey Hess <id@joeyh.name> + - Copyright 2022 Benjamin Barenblat <bbarenblat@gmail.com> - - Licensed under the GNU GPL version 3 or higher. -} @@ -16,10 +17,12 @@ data DesktopNotify = DesktopNotify } deriving (Show) +instance Semigroup DesktopNotify where + DesktopNotify s1 f1 <> DesktopNotify s2 f2 = + DesktopNotify (s1 || s2) (f1 || f2) + instance Monoid DesktopNotify where mempty = DesktopNotify False False - mappend (DesktopNotify s1 f1) (DesktopNotify s2 f2) = - DesktopNotify (s1 || s2) (f1 || f2) mkNotifyStart :: DesktopNotify mkNotifyStart = DesktopNotify True False diff --git a/Types/Difference.hs b/Types/Difference.hs index 4abc75c44..8516a3df7 100644 --- a/Types/Difference.hs +++ b/Types/Difference.hs @@ -1,6 +1,7 @@ {- git-annex repository differences - - Copyright 2015 Joey Hess <id@joeyh.name> + - Copyright 2022 Benjamin Barenblat <bbarenblat@gmail.com> - - Licensed under the GNU GPL version 3 or higher. -} @@ -67,14 +68,16 @@ instance Eq Differences where , oneLevelBranchHash ] -instance Monoid Differences where - mempty = Differences False False False - mappend a@(Differences {}) b@(Differences {}) = a +instance Semigroup Differences where + a@(Differences {}) <> b@(Differences {}) = a { objectHashLower = objectHashLower a || objectHashLower b , oneLevelObjectHash = oneLevelObjectHash a || oneLevelObjectHash b , oneLevelBranchHash = oneLevelBranchHash a || oneLevelBranchHash b } - mappend _ _ = UnknownDifferences + _ <> _ = UnknownDifferences + +instance Monoid Differences where + mempty = Differences False False False readDifferences :: String -> Differences readDifferences = maybe UnknownDifferences mkDifferences . readish diff --git a/Types/Test.hs b/Types/Test.hs index 50c460f50..0179474b4 100644 --- a/Types/Test.hs +++ b/Types/Test.hs @@ -1,6 +1,7 @@ {- git-annex test data types. - - Copyright 2011-2017 Joey Hess <id@joeyh.name> + - Copyright 2022 Benjamin Barenblat <bbarenblat@gmail.com> - - Licensed under the GNU GPL version 3 or higher. -} @@ -19,13 +20,15 @@ data TestOptions = TestOptions , internalData :: CmdParams } -instance Monoid TestOptions where - mempty = TestOptions mempty False False mempty - mappend a b = TestOptions +instance Semigroup TestOptions where + a <> b = TestOptions (tastyOptionSet a <> tastyOptionSet b) (keepFailuresOption a || keepFailuresOption b) (fakeSsh a || fakeSsh b) (internalData a <> internalData b) +instance Monoid TestOptions where + mempty = TestOptions mempty False False mempty + type TestRunner = TestOptions -> IO () |