Re: [Haskell-cafe] Ambiguous reified dictionaries

2009-04-15 Thread Jules Bean

Simon Peyton-Jones wrote:
 Yes, Haskell says that in any program there should be only one
 instance for any particular type (here Monoid Int).  GHC
 doesn't check that, but it should really do so.  It's not
 necessary for soundness (ie no runtime crash) but it is
 necessary for coherence (ie when you run the program the answer
 you get doesn't depend on which dictionary the typechecker
 arbitrarily chose).

Unless of course, your program implicitly depends on the coherence of 
dictionary choice for its own soundness, for example, a program using 
Data.Typeable to implement Dynamic or similar.


Jules

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Ambiguous reified dictionaries

2009-04-09 Thread Martijn van Steenbergen

Lennart Augustsson wrote:

That program is incorrect, it contains two instances for Monoid Int,
and the compiler should flag it as illegal.


Two simultaneous instances are okay as long as you don't use any of 
those instances, right? Just like two imported symbols with the same 
name are okay as long as you don't use them.


Martijn.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe