[Haskell] A puzzle and an annoying feature
k.schupke at imperial.ac.uk
Thu Nov 25 09:38:29 EST 2004
No, closed classes are different, here we are talking about lazy overlap
if at _call_ time only one instance fits we choose it. Closing a class
Daan Leijen wrote:
> Lennart Augustsson wrote:
>> So in what sense is this really ambiguous?
>> I think it would be quite reasonable to allow the Puzzle module
>> to compile, resolving `a' to be Bool. I.e., if there is only one
>> instance that can satisfy a constraint and there is no possibility
>> of adding instances outside the compiled module, I think resolving the
>> overloading makes sense.
> You may be interested in a recent paper by Bastiaan Heeren and Juriaan
> Hage  about type class directives. The "closed" directive in that
> paper is more or less implied by your example. Here is a quote from
> the paper:
> "The main advantage of a closed type class is that we know the fixed
> set of instances. Using this knowledge, we can influence the type
> inference process. As discussed in the introduction to Section 2, we
> can reject definitions early on (in case the set of instances for a
> certain type class is empty) or improve a type variable to a certain
> type (in case the set of instances is a singleton)."
> All the best,
> -- Daan Leijen.
>  http://www.cs.uu.nl/~bastiaan/papers.html#typeclassdirectives
> (to appear in PADL 2005)
>> -- Lennart
>> Haskell mailing list
>> Haskell at haskell.org
> Haskell mailing list
> Haskell at haskell.org
More information about the Haskell