[Haskell] A puzzle and an annoying feature
daan at cs.uu.nl
Wed Nov 24 16:56:26 EST 2004
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
"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.
(to appear in PADL 2005)
> -- Lennart
> Haskell mailing list
> Haskell at haskell.org
More information about the Haskell