leftToMaybe/rightToMaybe

Erik Hesselink hesselink at gmail.com
Wed Aug 7 19:13:06 CEST 2013


> Ivan Lazar Miljenovic wrote:
>> If we're starting to add functions to Data.Either, I've often used
>> something like this:
>>
>> mapEither :: (l -> l') -> (r -> r') -> Either l r -> Either l' r'
>> mapEither fl fr = either (Left . fl) (Right . fr)

This function is hidden in Control.Arrow as (+++).

There are more useful functions in there, but it's sometimes hard to
find them, especially now that we can no longer use type operators for
type variables.

Erik




More information about the Libraries mailing list