@@ -1,12 +1,22 @@
11
22data Either a b = Left a | Right b
33
4+either : (a -> c) -> (b -> c) -> Either a b -> c
45either f g e = case e of { Left x -> f x ; Right y -> g y }
56
7+
8+isLeft : Either a b -> Bool
69isLeft e = case e of { Left _ -> True ; _ -> False }
10+
11+isRight : Either a b -> Bool
712isRight e = case e of { Right _ -> True ; _ -> False }
813
14+
15+lefts : [Either a b] -> [a]
916lefts = Elm.List.filter isLeft
17+
18+rights : [Either a b] -> [b]
1019rights = Elm.List.filter isRight
1120
21+partition : [Either a b] -> ([a],[b])
1222partition = Elm.List.partition isLeft