@@ -1,7 +1,7 @@
2module Either where
2module Either where
4−import List (filter, partition)
4+import List
6data Either a b = Left a | Right b
6data Either a b = Left a | Right b
@@ -9,18 +9,18 @@ either : (a -> c) -> (b -> c) -> Either a b -> c
9either f g e = case e of { Left x -> f x ; Right y -> g y }
9either f g e = case e of { Left x -> f x ; Right y -> g y }
12−isLeft : Either a b -> Bool
12+isLeft : Either a b -> Bool
13−isLeft e = case e of { Left _ -> True ; _ -> False }
13+isLeft e = case e of { Left _ -> True ; _ -> False }
15isRight : Either a b -> Bool
15isRight : Either a b -> Bool
16isRight e = case e of { Right _ -> True ; _ -> False }
16isRight e = case e of { Right _ -> True ; _ -> False }
19−lefts : [Either a b] -> [a]
19+--lefts : [Either a b] -> [a]
20−lefts = filter isLeft
20+lefts es = List.filter isLeft es
22−rights : [Either a b] -> [b]
22+--rights : [Either a b] -> [b]
23−rights = filter isRight
23+rights es = List.filter isRight es
25−partition : [Either a b] -> ([a],[b])
25+--partition : [Either a b] -> ([a],[b])
26−partition = partition isLeft
26+partition es = List.partition isLeft es