[Haskell] A puzzle and an annoying feature
Daan Leijen
daan at cs.uu.nl
Wed Nov 24 16:56:26 EST 2004
Lennart Augustsson wrote:
> [snip]
> 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 [1] 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.
[1] http://www.cs.uu.nl/~bastiaan/papers.html#typeclassdirectives
(to appear in PADL 2005)
>
> -- Lennart
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>
>
>
More information about the Haskell
mailing list