[Haskell-cafe] performance question

Aleksey Khudyakov alexey.skladnoy at gmail.com
Wed Feb 13 22:24:38 CET 2013


On 13.02.2013 21:41, Brandon Allbery wrote:
> On Wed, Feb 13, 2013 at 11:32 AM, Nicolas Bock <nicolasbock at gmail.com
> <mailto:nicolasbock at gmail.com>> 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,
>
>
> The native solution is a parser like parsec/attoparsec.  The problem
> with regexes is that you can't at compile time verify that, for example,
> you have as many matching groups in the regex as the code using it
> expects, nor does an optional matching group behave as a Maybe like it
> should; nor are there nice ways to recover.  A parser gives you full
> control and better compile time checking, and is generally recommended.
>
Regexps only have this problem if they are compiled from string. Nothing 
prevents from building them using combinators. regex-applicaitve[1] uses 
this approach and quite nice to use.

[1] http://hackage.haskell.org/package/regex-applicative



More information about the Haskell-Cafe mailing list