Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: <oleg-e+AXbWqSrlAAvxtiuMwx3w <at> public.gmane.org>
Subject: deriving Typeable
Newsgroups: gmane.comp.lang.haskell.prime
Date: Wednesday 5th April 2006 03:38:35 UTC (over 11 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.
 
CD: 3ms