Subject: deriving Typeable
Date: Wednesday 5th April 2006 03:38:35 UTC (over 12 years ago)
John Meacham wrote: > things like DeepSeq and Typeable will most likely have optimized > versions on various compilers which is why I'd like to see the > restriction that the only way to create instances for these two > classes is via the "deriving" mechanism of the compiler. Please make it so! Allowing users to create their own instances of Typeable is tantamount to allowing them to define the _total_ function unsafeCoerce :: (Typable a, Typeable b) => a -> b That function always succeeds; you don't want to trust its result in general though. If we add -fallow-incoherent-instances, then the Typeable constraint disappears and we obtain the total function of the type a->b. The fact these functions are expressible in Haskell at all is quite disconcerting.