Henning Thielemann <[EMAIL PROTECTED]> 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.

List is a backtracking monad, while Maybe is merely an error monad.  You
have to have backtracking to bet better than LL(1) or LR(1) parsing, and
LL(1) is not an acceptable restriction for a fundamental function like
read.

Jonathan Cast
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to