Haskell' - class aliases

Simon Peyton-Jones simonpj at microsoft.com
Fri May 2 06:54:13 EDT 2008

| > Crumbs!  I have no idea what that means!  Did you really mean to repeat "Foo"?  According to your
| expansion in type signatures
| >         f :: (Foo a) => ...
| > expands to
| >         f :: (Foo a, Bar a) => ...
| > which presumably expands again.  I'm totally lost here
| Yes I did, because I wanted to make the differences between class alias
| contexts and superclasses very clear, the above context is valid, if
| vacuous. the expansion goes as follows .
| 1. Foo a --> reduce(Foo a,Bar a)
|         -- Foo a expanded

Even more crumbs!  Is this fixpoint iteration (being careful to avoid infinite expansion) *really* essential to your proposal?  That would be a significant and unwelcome thing IMHO.

To be concrete, consider
        f :: (Foo a) => ...

In GHC, f really takes an extra dictionary argument for the class Foo.  If aliases mean aliases in the sense of type synonyms (which I think you intend) you must expand Foo to find out whether f takes zero, one, or many dictionary arguments.  Furthermore, everyone must expand in precisely the same way, so that we agree on the order of these arguments.  That's reasonably simple if "expand" simply means "normalise"; but it's more complicated if there's a fixpoint algorithm involved.

So is this really crucial?


More information about the Haskell-prime mailing list