Match class

Bulat Ziganshin bulatz at HotPOP.com
Sun Jan 29 18:33:31 EST 2006


Hello Claus,

Friday, January 27, 2006, 3:51:26 AM, you wrote:

CR> I don't want to lose numeric literals in patterns! But, having recovered
CR> from the first shock, and ignoring other people's hats, there may be a
CR> few things that need cleaning up in that area (why do some patterns
CR> work without Eq, some with? Should there be a Match class or 
CR> something to pin down what can and what can't be matched how?..).

this makes sense for me. Ruby has the special class for matching, so
that something like

case x of
  "str" -> 1
  1.1   -> 2
  /regexp/ -> 3

translated into the

if x =~ "str" then 1
else if x =~ 1.1 then 2
else if x =~ /regexp/ then 3

that allows to define matching rules by writing appropriate
definitions for "=~"



-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-prime mailing list