@@ -52,28 +52,16 @@ have the equivalence: `(partition es == (lefts es, rights es))`
5252partition : [Either a b] -> ([a],[b])
5353partition es = List.foldr consEither ([],[]) es
5454
55−{-| If `Left`, add the value to the front of the list.
56−If `Right`, return the list unchanged
57−-}
58−consLeft : Either a b -> [a] -> [a]
5955consLeft e vs =
6056 case e of
6157 Left v -> v::vs
6258 Right _ -> vs
6359
64−{-| If `Right`, add the value to the front of the list.
65−If `Left`, return the list unchanged.
66−-}
67−consRight : Either a b -> [b] -> [b]
6860consRight e vs =
6961 case e of
7062 Left _ -> vs
7163 Right v -> v::vs
7264
73−{-| If `Left`, add the value to the left list.
74−If `Right`, add the value to the right list.
75−-}
76−consEither : Either a b -> ([a], [b]) -> ([a], [b])
7765consEither e (ls,rs) =
7866 case e of
7967 Left l -> (l::ls,rs)