
18 Apr
2014
18 Apr
'14
4:54 p.m.
hi, i propose to include the following functions into Data.Either. mapLeft :: (a->b) -> Either a c -> Either b c mapLeft f = bimap f id bimap :: (a -> b) -> (c -> d) -> Either a c -> Either b d bimap f g = either (Left . f) (Right . g) bimap and mapLeft already exists in edward kmett's either library (and in categories-extras and in gabriel gonzales' errors), but imo they are very useful by itself to warrant an inclusion in base. given bimap, mapLeft might not cross the fairbairn threshold though. note: i don't propose exporting them from Prelude. discussion period: 2 weeks cheers, tobias florek