Records in Haskell

Ingo Wechsung ingo.wechsung at
Sun Jan 8 13:45:58 CET 2012

2012/1/8 Gábor Lehel <illissius at>

> The second is that only the author of the datatype could put functions
> into its namespace; the '' notation would only be available
> for functions written by the datatype's author, while for every other
> function you would have to use 'foo data'. I dislike this special
> treatment in OO languages and I dislike it here.

Please allow me to clarify as far as Frege is concerned.
In Frege, this is not so, because implementations of class functions in an
instance will be linked back to the  instantiated types name space. Hence
one could do the following:

module RExtension where

import original.M(R)    -- access the R record defined in module original.M

class Rextension1 r where
      firstNewFunction :: .....
      secondNewFunction :: .....

instance Rextension1 R where
     -- implementation for new functions

And now, in another module one could

import RExtension()      -- equivalent to qualified import in Haskell

and, voilá, the new functions are accessible (only) through R

Mit freundlichen Grüßen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Glasgow-haskell-users mailing list