diff options
author | Benjamin Barenblat <bbarenblat@gmail.com> | 2022-01-19 13:11:40 -0500 |
---|---|---|
committer | Benjamin Barenblat <bbarenblat@gmail.com> | 2022-01-19 13:31:05 -0500 |
commit | a9b9e5d0d72c2348580dbac5533b89a45abd8938 (patch) | |
tree | 0f8113e86df43616baec8570b07acb1537497885 /Git/Fsck.hs | |
parent | c79473051a8e1647b14f351b72768b74301acc33 (diff) |
Deal with the Semigroup/Monoid proposal
base-4.11 made Semigroup a superclass of Monoid. Provide Semigroup
implementations for Monoids.
Diffstat (limited to 'Git/Fsck.hs')
-rw-r--r-- | Git/Fsck.hs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Git/Fsck.hs b/Git/Fsck.hs index a716b56e3..a1b42a953 100644 --- a/Git/Fsck.hs +++ b/Git/Fsck.hs @@ -1,6 +1,7 @@ {- git fsck interface - - Copyright 2013 Joey Hess <id@joeyh.name> + - Copyright 2022 Benjamin Barenblat <bbarenblat@gmail.com> - - Licensed under the GNU GPL version 3 or higher. -} @@ -44,15 +45,17 @@ type MissingObjects = S.Set Sha type Truncated = Bool +instance Semigroup FsckOutput where + FsckOutput s1 t1 <> FsckOutput s2 t2 = FsckOutput (S.union s1 s2) (t1 || t2) + FsckOutput s t <> _ = FsckOutput s t + _ <> FsckOutput s t = FsckOutput s t + NoFsckOutput <> NoFsckOutput = NoFsckOutput + AllDuplicateEntriesWarning <> AllDuplicateEntriesWarning = AllDuplicateEntriesWarning + AllDuplicateEntriesWarning <> NoFsckOutput = AllDuplicateEntriesWarning + NoFsckOutput <> AllDuplicateEntriesWarning = AllDuplicateEntriesWarning + instance Monoid FsckOutput where mempty = NoFsckOutput - mappend (FsckOutput s1 t1) (FsckOutput s2 t2) = FsckOutput (S.union s1 s2) (t1 || t2) - mappend (FsckOutput s t) _ = FsckOutput s t - mappend _ (FsckOutput s t) = FsckOutput s t - mappend NoFsckOutput NoFsckOutput = NoFsckOutput - mappend AllDuplicateEntriesWarning AllDuplicateEntriesWarning = AllDuplicateEntriesWarning - mappend AllDuplicateEntriesWarning NoFsckOutput = AllDuplicateEntriesWarning - mappend NoFsckOutput AllDuplicateEntriesWarning = AllDuplicateEntriesWarning {- Runs fsck to find some of the broken objects in the repository. - May not find all broken objects, if fsck fails on bad data in some of |