
1 Jan
2008
1 Jan
'08
9:49 p.m.
Josef Svenningsson writes:
On Dec 28, 2007 11:40 PM, Mitar
wrote: Would not it be interesting and useful (but not really efficient) to have patterns something like:
foo :: Eq a => a -> ... foo (_{4}'b') = ...
which would match a list with four elements ending with an element 'b'. Or:
foo (_+';'_+';'_) = ...
which would match a list with embedded two ';' elements. (Last _ matched the remaining of the list.)
I suggest you take at look at HaRP, Haskell Regular Patterns: http://www.cs.chalmers.se/~d00nibro/harp/
It hasn't been updated for a while but it should still be useable.
Also of interest might be XHaskell http://taichi.ddns.comp.nus.edu.sg/taichiwiki/XhaskellHomePage which adds XDuce style regular expression pattern matching to Haskell. Martin