Added another helper function to the Utils module

This commit is contained in:
Neil Brown 2007-10-28 01:22:55 +00:00
parent aea462d41a
commit d2e54ea483

View File

@ -21,6 +21,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
module Utils where
import Control.Monad
import Data.Ord
import System.IO
import System.IO.Error
import Text.Regex
@ -94,3 +95,10 @@ mapPairs :: (a -> a -> b) -> [a] -> [b]
mapPairs _ [] = []
mapPairs _ [x] = []
mapPairs f (x0:(x1:xs)) = (f x0 x1) : (mapPairs f (x1:xs))
-- | Given a list of comparisons in order major->minor, returns the resultant ordering
combineCompare :: [Ordering] -> Ordering
combineCompare [] = EQ
combineCompare (LT:_) = LT
combineCompare (GT:_) = GT
combineCompare (EQ:os) = combineCompare os