leftToMaybe/rightToMaybe

Christopher Done chrisdone at gmail.com
Tue Aug 6 12:21:14 CEST 2013


How about popping these in Data.Either?

-- | Maybe get the left side of an Either.
leftToMaybe :: Either a b -> Maybe a
leftToMaybe = either Just (const Nothing)

-- | Maybe get the right side of an Either.
rightToMaybe :: Either a b -> Maybe b
rightToMaybe = either (const Nothing) Just




More information about the Libraries mailing list