
30 Mar
2007
30 Mar
'07
12:59 a.m.
On Fri, Mar 30, 2007 at 05:43:34AM +0200, paolino wrote:
Hi, I had a bad time trying to parse the words of a text. I suspect I miss some parsec knowledge.
I'd start by not sextuple-posting, it just sextuples the ugliness ;-) Anyway, I think parsec is *far* too big a hammer for the nail you're trying to hit. import Char( isAlpha ) import List( groupBy ) equating f x y = f x == f y -- in Data.Eq, iff you have GHC 6.7 isLetter x = isAlpha x || x == '_' || x == '@' myWords = filter (isLetter . head) . groupBy (equating isLetter) Stefan