leftToMaybe/rightToMaybe

Daniel Trstenjak daniel.trstenjak at gmail.com
Thu Aug 8 09:40:20 CEST 2013


> Some minor nitpicking: IMHO, the naming is inconsistent with
> respect to the existing functions:
> 
>   listToMaybe :: [a] -> Maybe a
>   maybeToList :: Maybe a -> [a]
> 
> In these two cases, '[lL]ist' and '[mM]aybe' both denote types, whereas
> in '{left,right}ToMaybe', 'left' is a constructor and 'Maybe' is a type.
> However, I have no better naming alternative to offer.

The names 'leftToMaybe' and 'rightToMaybe' could also be slightly irritating,
because reading the name 'leftToMaybe' might provoke the question: and
what happens for the 'Right' case.

I would prefer the names 'left' and 'right', but If the name clash with
'Control.Arrow' is an issue, than perhaps 'maybeLeft' and 'maybeRight'.


Greetings,
Daniel




More information about the Libraries mailing list