Prelude function suggestions

Peter Simons simons at cryp.to
Wed Jul 28 12:59:26 EDT 2004


Marcin 'Qrczak' Kowalczyk writes:

 > You can try using Parsec or another similar library for
 > more complex tasks.

IMHO, Parsec is too complicated for something that simply.
Stick to the example of implementing a 'lines' that uses
\r\n instead of \n, if you will: I don't want any monads, I
don't want error messages, I don't need any recursive
descent parser. All I need is a simple tokenizer. In the
past I have used 'lines' and then chopped off the last
character off each line. Fair enough, but I think that there
is a more general problem underneath that deserves to be
solved.

I see this function underneath Parsec. I would, under the
right circumstances, use Parsec to write the functions I
give to 'tokenize' as arguments! But I wouldn't write
'tokenize' in Parsec.


 > What if both return True, or if neither returns True?

That's an 'error'.


 > This is my SplitSeps (formerly Split1), assuming the
 > second function is just the negation of the first one.

Great! Then I second that your function is added to the
standard library. :-)

Peter



More information about the Libraries mailing list