33{-# LANGUAGE DuplicateRecordFields #-}
44{-# LANGUAGE FlexibleContexts #-}
55{-# LANGUAGE RankNTypes #-}
6+ {-# LANGUAGE StandaloneDeriving #-}
67{-# LANGUAGE TupleSections #-}
78
89-----------------------------------------------------------------------------
@@ -132,6 +133,9 @@ data BuildTarget
132133 BuildTargetFile ComponentName FilePath
133134 deriving (Eq , Show , Generic )
134135
136+ -- | @since 3.18
137+ deriving instance Ord BuildTarget
138+
135139instance Binary BuildTarget
136140
137141buildTargetComponentName :: BuildTarget -> ComponentName
@@ -855,6 +859,9 @@ data MatchError
855859 | MatchErrorNoSuch String String
856860 deriving (Show , Eq )
857861
862+ -- | @since 3.18
863+ deriving instance Ord MatchError
864+
858865instance Alternative Match where
859866 empty = mzero
860867 (<|>) = mplus
@@ -943,13 +950,13 @@ increaseConfidence = ExactMatch 1 [()]
943950increaseConfidenceFor :: Match a -> Match a
944951increaseConfidenceFor m = m >>= \ r -> increaseConfidence >> return r
945952
946- nubMatches :: Eq a => Match a -> Match a
953+ nubMatches :: Ord a => Match a -> Match a
947954nubMatches (NoMatch d msgs) = NoMatch d msgs
948- nubMatches (ExactMatch d xs) = ExactMatch d (nub xs)
949- nubMatches (InexactMatch d xs) = InexactMatch d (nub xs)
955+ nubMatches (ExactMatch d xs) = ExactMatch d (ordNub xs)
956+ nubMatches (InexactMatch d xs) = InexactMatch d (ordNub xs)
950957
951958nubMatchErrors :: Match a -> Match a
952- nubMatchErrors (NoMatch d msgs) = NoMatch d (nub msgs)
959+ nubMatchErrors (NoMatch d msgs) = NoMatch d (ordNub msgs)
953960nubMatchErrors (ExactMatch d xs) = ExactMatch d xs
954961nubMatchErrors (InexactMatch d xs) = InexactMatch d xs
955962
@@ -970,14 +977,14 @@ tryEach = exactMatches
970977-- | Given a matcher and a key to look up, use the matcher to find all the
971978-- possible matches. There may be 'None', a single 'Unambiguous' match or
972979-- you may have an 'Ambiguous' match with several possibilities.
973- findMatch :: Eq b => Match b -> MaybeAmbiguous b
980+ findMatch :: Ord b => Match b -> MaybeAmbiguous b
974981findMatch match =
975982 case match of
976- NoMatch _ msgs -> None (nub msgs)
983+ NoMatch _ msgs -> None (ordNub msgs)
977984 ExactMatch _ xs -> checkAmbiguous xs
978985 InexactMatch _ xs -> checkAmbiguous xs
979986 where
980- checkAmbiguous xs = case nub xs of
987+ checkAmbiguous xs = case ordNub xs of
981988 [x] -> Unambiguous x
982989 xs' -> Ambiguous xs'
983990
0 commit comments