[Hugs-users] Record puns, time for removal?

Lennart Augustsson lennart at augustsson.net
Mon Oct 30 17:16:43 EST 2006


Funny that you should mention this idea.  I spent last night and this  
morning implementing it in ghc.  But I use '..' instead of '*'.

The punning is available both for expressions and patterns.

I am of two minds about this extension.  It introduces bound  
variables without mentioning the variable at the binding site.  This  
can be error prone.  (But 'import' has similar problems.)

Dubious as it is, when using large records it reduces the amount of  
boiler place code significantly.

	-- Lennart

On Oct 30, 2006, at 16:20 , Bulat Ziganshin wrote:

> Hello Simon,
>
> Monday, October 30, 2006, 3:11:23 PM, you wrote:
>
>> I always thought it was a mistake to remove record puns in H98.  I  
>> would
>> not be against re-introducing them into GHC, since they appear to  
>> remain
>> in Hugs and are in Yhc.
>
> what you (and all) think about wildcarded puns:
>
> 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
>    ...
>
> because Haskell encourage using of structure name as part of field's
> name, this will not create mess (at least for my programs), it will
> work like Pascal's 'with' operator
>
>
>
> -- 
> Best regards,
>  Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-prime



More information about the Haskell-prime mailing list