On Thu, May 20, 2010 at 7:54 PM, Max Bolingbroke < batterseapo...@hotmail.com> wrote:
> On 20 May 2010 20:30, Carlos Camarao <carlos.cama...@gmail.com> wrote: > > > ... Also, the same fragilty occurs if FDs are used. > > This remark is surprising to me. I thought the point of the FDs being > declared on the original class (and the subsequent coverage condition > check on instances) was to ensure that this fragility couldn't happen. > Can you show an example (without using orphan instances) so I can get > the idea? > > Thanks, > Max > Well, what I meant is just that the same would happen if we had a FD a->b in Example 1... (maybe I am not following you). That is: the same would happen if Example 1 was written with a FD as follows: class F a b | a -> b where f:: a -> b instance O a where o:: a And we had the same context: instance F Bool Bool where f = not instance O Bool where o = True k = f o kb = not k Then: kb is well-typed, because FD a |->b "closes the world", causing type (F a b, O a)=>Bool to be simplified ("improved") to Bool. But this type-correct program would become not typeable if instances such as the ones referred to before (by Daniel Fischer) instance F Int Bool where f = even instance O Int where o = 0 were later introduced, or imported... Cheers, Carlos
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe