Haskell' - class aliases
john at repetae.net
Fri May 2 05:28:06 EDT 2008
On Fri, May 02, 2008 at 08:30:59AM +0200, Tom Schrijvers wrote:
>> Note that when declaring an instance of a concrete type, like Int, the
>> constraint (S Int) will be trivially satisfied or not at compile time.
>> (bf2 is free to use methods of 'S' of course).
>> this translation is also a bijection, declaring those two instances
>> manually as above is indistinguishable from declaring instances via the
>> alias in all ways.
>> Hopefully the generalization to arbitrary numbers of classes is clear...
> What about multiple parameters? Can A have more parameters than the Ci?
> Should they be in the same order? Should they overlap?
> What about instance contexts, like:
> instance I a => A a where ...
Ah, I originally had instance contexts in my example, but left them out
for clarity of the main points. instance contexts are just copied
verbatim into each expanded instance.
> (What about functional dependencies?)
I am leaving out MPTCs and hence fundeps for now, I do not believe they
will present an issue, as nothing about the expansion depends on the
number of arguments, but I want to make sure we have a clear
understanding of what class aliases imply for haskell 98 one constructor
type classes first.
I think the extension to MPTCs is clear, not so clear for fundeps but
not unsolvable, then again, nothing much is clear about the future of
fundeps so I don't think that is a big issue.
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell-prime