Hello Richard,

Monday, October 30, 2006, 4:20:29 AM, you wrote:

> What is a "record PUN"?  Looking at the example,

in h98, you should write smth like this:

data Point = Point {x :: Int, y :: Int}
f (Point {x=x})   =  x

but record pun allows you to compact this into:

f (Point {x})   =  x


Here, it seems like small improvement. But my program contains a lot
of records that i want to use inside functions. i will be glad to see
even improved version of record pun:

data Command = Command {
    cmd_name                 :: !String             
  , cmd_arcspec              ::  String             
  , cmd_arclist              ::  [FilePath]         
  , cmd_arcname              ::  FilePath           
  , cmd_arc_filter           :: !(FileInfo -> Bool) 
  , cmd_filespecs            :: ![String]           
  , cmd_added_arcnames       :: !(IO [FilePath])    
  , cmd_diskfiles            :: !(IO [FileInfo])    
  , cmd_subcommand           :: !Bool               
....
}

process_cmd (Command{*}) = do
   print cmd_name
   ...

Wildcard puns will greatly simplify my top-level code which
manipulates with dozens of fields from this record


-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Hugs-Users mailing list
Hugs-Users@haskell.org
http://www.haskell.org/mailman/listinfo/hugs-users

Reply via email to