[Haskell-cafe] performance question

wren ng thornton wren at freegeek.org
Thu Feb 14 05:18:13 CET 2013


On 2/13/13 11:32 AM, Nicolas Bock wrote:
> Since I have very little experience with Haskell and am not used to
> Haskell-think yet, I don't quite understand your statement that regexes are
> seen as foreign to Haskell-think. Could you elaborate? What would a more
> "native" solution look like? From what I have learned so far, it seems to
> me that Haskell is a lot about clear, concise, and well structured code. I
> find regexes extremely compact and powerful, allowing for very concise
> code, which should fit the bill perfectly, or shouldn't it?

Regexes are powerful and concise for recognizing regular languages. They 
are not, however, very good for *parsing* regular languages; nor can 
they handle non-regular languages (unless you're relying on the badness 
of pcre). In other languages people press regexes into service for 
parsing because the alternative is using an external DSL like lex/yacc, 
javaCC, etc. Whereas, in Haskell, we have powerful and concise tools for 
parsing context-free languages and beyond (e.g., parsec, attoparsec).

-- 
Live well,
~wren



More information about the Haskell-Cafe mailing list