Re: [Haskell-cafe] ReadS with Maybe

5 Jan
2005
5 Jan
'05
11:11 a.m.
Henning Thielemann
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
7441
Age (days ago)
7441
Last active (days ago)
0 comments
1 participants
participants (1)
-
Jon Cast