@@ -268,15 +268,29 @@ module Prelude where
268268 LT -> false
269269 _ -> true
270270
271− foreign import numCompare
272− "function numCompare(n1) {\
271+ foreign import unsafeCompare
272+ "function unsafeCompare(n1) {\
273273 \ return function(n2) {\
274274 \ return n1 < n2 ? LT : n1 > n2 ? GT : EQ;\
275275 \ };\
276− \}" :: Number -> Number -> Ordering
277−
276+ \}" :: forall a. a -> a -> Ordering
277+
278+ instance ordBoolean :: Ord Boolean where
279+ compare false false = EQ
280+ compare false true = LT
281+ compare true true = EQ
282+ compare true false = GT
283+
278284 instance ordNumber :: Ord Number where
279− compare = numCompare
285+ compare = unsafeCompare
286+
287+ instance ordString :: Ord String where
288+ compare = unsafeCompare
289+
290+ instance ordArray :: (Ord a) => Ord [a] where
291+ compare (x:xs) (y:ys) = case compare x y of
292+ EQ -> compare xs ys
293+ other -> other
280294
281295 infixl 10 &
282296 infixl 10 |