exported pattern matching

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu Feb 9 15:02:21 EST 2006

Philippa Cowderoy <flippa at flippac.org> writes:

> Myself I'm of the view transformational patterns (as described in
> http://citeseer.ist.psu.edu/299277.html) are more interesting -
> I can't help wondering why they were never implemented?

Ah, so I wasn't first in implementing them in my language :-)

It includes the following kinds of patterns (x is the value to be

  when f args...    | matches if f x args... is true
  where f args... p | matches if p matches f x args...
  p1 & p2           | matches if both p1 and p2 match
                    | (p2 may use variables bound by p1)
  define {defs}     | matches anything, executes definitions,
                    | binds variables they introduce
  if cond           | matches anything if cond is true
  match e p         | matches anything if p matches e

This seems complex, OTOH it doesn't have guards.
Haskell wouldn't need those "args..." because it curries.

   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

More information about the Haskell-prime mailing list