Lambda the Ultimate

inactiveTopic First Class Patterns
started 11/29/2002; 3:38:28 PM - last post 11/30/2002; 9:04:23 AM
Ehud Lamm - First Class Patterns  blueArrow
11/29/2002; 3:38:28 PM (reads: 2310, responses: 2)
First Class Patterns
Mark Tullsen. First Class Patterns. Practical Aspects of Declarative Languages, Second International Workshop, PADL 2000. volume 1753 of Lecture Notes in Computer Science. January 2000.

The key idea presented in this paper is to treat patterns as functions of type a -> Maybe b, thus making patterns into (first class) functions.

Aside from all else, this is a nice example of language design. The pattern language is embedded in the host language (Haskell).


Posted to functional by Ehud Lamm on 11/29/02; 3:40:13 PM

Albert Y. C. Lai - Re: First Class Patterns  blueArrow
11/29/2002; 9:59:15 PM (reads: 603, responses: 1)
One single concept that replaces several. Beautiful unification. But I worry a bit about the consequence of having to write functions either in the pointfree style (e.g., see the body of zipList) or using the suggested pattern binder syntax (e.g., the take example). They don't look very natural. But of course these can be fixed.

Ehud Lamm - Re: First Class Patterns  blueArrow
11/30/2002; 9:04:23 AM (reads: 621, responses: 0)
They don't look very natural. But of course these can be fixed.

Sure, that's what macros are for