Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Bulat Ziganshin <bulatz-XB074ZWRHQ/QT0dZR+AlfA <at> public.gmane.org>
Subject: Match class
Newsgroups: gmane.comp.lang.haskell.prime
Date: Sunday 29th January 2006 23:33:31 UTC (over 11 years ago)
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-XB074ZWRHQ/[email protected]
 
CD: 3ms