@@ -1,12 +1,22 @@
2data Either a b = Left a | Right b
2data Either a b = Left a | Right b
4+either : (a -> c) -> (b -> c) -> Either a b -> c
4either f g e = case e of { Left x -> f x ; Right y -> g y }
5either f g e = case e of { Left x -> f x ; Right y -> g y }
8+isLeft : Either a b -> Bool
6isLeft e = case e of { Left _ -> True ; _ -> False }
9isLeft e = case e of { Left _ -> True ; _ -> False }
11+isRight : Either a b -> Bool
7isRight e = case e of { Right _ -> True ; _ -> False }
12isRight e = case e of { Right _ -> True ; _ -> False }
15+lefts : [Either a b] -> [a]
9lefts = Elm.List.filter isLeft
16lefts = Elm.List.filter isLeft
18+rights : [Either a b] -> [b]
10rights = Elm.List.filter isRight
19rights = Elm.List.filter isRight
21+partition : [Either a b] -> ([a],[b])
12partition = Elm.List.partition isLeft
22partition = Elm.List.partition isLeft