[Haskell] Extensible records: Static duck typing

Jason Dusek jason.dusek at gmail.com
Sun Feb 10 16:13:01 EST 2008


On Feb 5, 2008 4:24 AM, John Meacham <john at repetae.net> wrote:
> now when it came to record selection I was deciding between a couple.
>
>   <...snip.../>
>
> ...declare that any identifier that _begins_ with ' always
> refers to a label selection function
>
> 'x point

Say we go with 'x and allow it to pick the x field out of
records. All records. Then we have implicitly defined a function
'x that accepts things in the HasAnX class. This class is also
implicitly defined -- and things are added to it implicitly,
too, by giving them an x.

So, in a way, this is cool -- it's like structs but way less
verbose. On the other hand, it seems awfully like something that
could be handled as a templating thing. Since we already have
templates, couldn't we just add a few default ones to GHC and be
done with it?

-- 
_jsn


More information about the Haskell mailing list