Proposal: Add readMaybe (and possibly readEither) to Prelude, make Haddocks for read more cautionary

Yitzchak Gale gale at sefer.org
Wed Dec 28 19:29:46 UTC 2016


Tom wrote:
> What about other functions from 'safe',
> eg headMay, atMay, readNote, etc?

The standard spelling of "headMay", already included
in base, is "listToMaybe".

In general, once you have readMaybe, NonEmpty, and
the rich set of combinators and instances we have today
for Maybe and Either, the safe library really isn't needed
anymore.

It was a great innovation at the time - it brought the
problem of partial functions to the forefront. But I prefer
using the standard names we have for those functions
nowadays, or occasionally using a simple combination
of two of them. The function names in the safe library
always seemed a bit awkward to me.

YItz


More information about the Libraries mailing list