module Data.Record.HT.Private where
import Data.Monoid (mconcat, )
import Data.List.HT (switchL, )
compare :: [a -> a -> Ordering] -> a -> a -> Ordering
compare cs x y =
mconcat $ map (\c -> c x y) cs
compare1 :: [a -> a -> Ordering] -> a -> a -> Ordering
compare1 cs x y =
switchL EQ const $ dropWhile (EQ==) $ map (\c -> c x y) cs
compare2 :: [a -> a -> Ordering] -> a -> a -> Ordering
compare2 cs x y =
head $ dropWhile (EQ==) (map (\c -> c x y) cs) ++ [EQ]
equal :: [a -> a -> Bool] -> a -> a -> Bool
equal cs x y = all (\c -> c x y) cs