@@ -52,28 +52,16 @@ have the equivalence: `(partition es == (lefts es, rights es))`
52partition : [Either a b] -> ([a],[b])
52partition : [Either a b] -> ([a],[b])
53partition es = List.foldr consEither ([],[]) es
53partition es = List.foldr consEither ([],[]) es
55−{-| If `Left`, add the value to the front of the list.
56−If `Right`, return the list unchanged
58−consLeft : Either a b -> [a] -> [a]
59consLeft e vs =
55consLeft e vs =
61 Left v -> v::vs
57 Left v -> v::vs
62 Right _ -> vs
58 Right _ -> vs
64−{-| If `Right`, add the value to the front of the list.
65−If `Left`, return the list unchanged.
67−consRight : Either a b -> [b] -> [b]
68consRight e vs =
60consRight e vs =
70 Left _ -> vs
62 Left _ -> vs
71 Right v -> v::vs
63 Right v -> v::vs
73−{-| If `Left`, add the value to the left list.
74−If `Right`, add the value to the right list.
76−consEither : Either a b -> ([a], [b]) -> ([a], [b])
77consEither e (ls,rs) =
65consEither e (ls,rs) =
79 Left l -> (l::ls,rs)
67 Left l -> (l::ls,rs)