[Haskell-cafe] ReadS with Maybe

David Roundy droundy at abridgegame.org
Wed Jan 5 08:36:39 EST 2005

On Mon, Jan 03, 2005 at 08:48:26PM +0100, Henning Thielemann wrote:
> What is the reason for the definition
>  ReadS a = [(a, String)]
> not being
>  ReadS a = Maybe (a, String)
> ? The latter one reflects that either one or no value is read, whereas the
> first definition allows an arbitrary number of read values which is
> confusing and unsafe in my opinion.

Isn't that because there could be more than one way to read the string? For
example, in theory reads of an int from "123" might return

[(123,""), (12,"3"), (1,"23")]
David Roundy

More information about the Haskell-Cafe mailing list