Simon Marlow wrote:
> While I agree with these points, I was converted to record punning
> (actually record wildcards) when I rewrote the GHC IO library. Handle
> is a record with 12 or so fields, and there are literally dozens of
> functions that start like this:
>
> flushWriteBuffer :: Handle -> IO ()
> flushWriteBuffer Handle{..} = do
>
> if I had to write out the field names I use each time, and even worse,
> think up names to bind to each of them, it would be hideous.
What about using field names as functions?
flushWriteBuffer h@(Handle {}) = do
... buffer h ...
Of course, you always have to drag h around.
Regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
_______________________________________________
Haskell-prime mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-prime