[Haskell] Extensible records: Static duck typing

Cale Gibbard cgibbard at gmail.com
Tue Feb 5 08:01:07 EST 2008

On 05/02/2008, John Meacham <john at repetae.net> wrote:

> choice 2: use ', declare that any identifier that _begins_ with ' always
> refers to a label selection function
> 'x point
> (snip)
> none are fully backwards compatible. I am still not sure which I like
> the best, ' has a lot of appeal to me as it is very simple to type and
> lightweight visually.

I also like this idea. Retaining the ability to treat selection as a
function easily is quite important, and this meets that criterion
nicely. Also, in which case does this cause a program to break? It
seems that you're only reinterpreting what would be unterminated
character literals.

Did you consider any options with regard to the syntax for variants as
introduced in the paper? Perhaps something like (: and  :) brackets
could be used in place of the \langle and \rangle brackets used in the
paper. Labels would still start with single quotes. We wouldn't need
the decomposition syntax, just case, altered to agree with Haskell's
existing syntax for case. Pattern matching against labels (whose names
start with a single quote) unambiguously makes it clear that we're
working with variants.

 - Cale

More information about the Haskell mailing list