summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-09 14:08:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-09 14:08:45 -0400
commit893bb509cdde7974fcc758dd6396ebc42230b698 (patch)
treeb0c7388dc4827c96d536ef6f9ff365b731d51656
parent57f613cc8e9961af50ccf8bc59799a537fa7336a (diff)
use Monoid instance for Ordering
-rw-r--r--Assistant/Alert/Utility.hs5
-rw-r--r--Utility/Misc.hs12
2 files changed, 3 insertions, 14 deletions
diff --git a/Assistant/Alert/Utility.hs b/Assistant/Alert/Utility.hs
index db2ea1925..73843be4c 100644
--- a/Assistant/Alert/Utility.hs
+++ b/Assistant/Alert/Utility.hs
@@ -14,6 +14,7 @@ import Utility.Tense
import qualified Data.Text as T
import Data.Text (Text)
import qualified Data.Map as M
+import Data.Monoid
{- This is as many alerts as it makes sense to display at a time.
- A display might be smaller, or larger, the point is to not overwhelm the
@@ -43,8 +44,8 @@ compareAlertPairs
(aid, Alert { alertClass = aclass, alertPriority = aprio })
(bid, Alert { alertClass = bclass, alertPriority = bprio })
= compare aprio bprio
- `thenOrd` compare aid bid
- `thenOrd` compare aclass bclass
+ `mappend` compare aid bid
+ `mappend` compare aclass bclass
sortAlertPairs :: [AlertPair] -> [AlertPair]
sortAlertPairs = sortBy compareAlertPairs
diff --git a/Utility/Misc.hs b/Utility/Misc.hs
index 20007adad..9c19df833 100644
--- a/Utility/Misc.hs
+++ b/Utility/Misc.hs
@@ -109,18 +109,6 @@ massReplace vs = go [] vs
go (replacement:acc) vs (drop (length val) s)
| otherwise = go acc rest s
-{- Given two orderings, returns the second if the first is EQ and returns
- - the first otherwise.
- -
- - Example use:
- -
- - compare lname1 lname2 `thenOrd` compare fname1 fname2
- -}
-thenOrd :: Ordering -> Ordering -> Ordering
-thenOrd EQ x = x
-thenOrd x _ = x
-{-# INLINE thenOrd #-}
-
{- Wrapper around hGetBufSome that returns a String.
-
- The null string is returned on eof, otherwise returns whatever