@@ -110,6 +110,13 @@ split p xs = case break p xs of
110110 (chunk, []) => [chunk]
111111 (chunk, (c :: rest)) => chunk :: split p rest
112112
113+any : (a -> Bool) -> List a -> Bool
114+any predicate [] = False
115+any predicate (a::rest) =
116+ if predicate a
117+ then True
118+ else any predicate rest
119+
113120--------------------------------------------------------------------------------
114121-- Conversions
115122--------------------------------------------------------------------------------
@@ -133,3 +140,24 @@ catMaybes (x::xs) =
133140 Nothing => catMaybes xs
134141 Just j => j :: catMaybes xs
135142
143+--------------------------------------------------------------------------------
144+-- Instances
145+--------------------------------------------------------------------------------
146+
147+instance (Eq a) => Eq (List a) where
148+ (==) [] [] = True
149+ (==) (a::restA) (b::restB) =
150+ if a == b
151+ then restA == restB
152+ else False
153+ (==) _ _ = False
154+
155+
156+instance Ord a => Ord (List a) where
157+ compare [] [] = EQ
158+ compare [] _ = LT
159+ compare _ [] = GT
160+ compare (a::restA) (b::restB) =
161+ if a /= b
162+ then compare a b
163+ else compare restA restB