
Because, from a user's point of view, defining
newtype Age = MkAge Int
automatically creates Coercible instances
instance Coercible Age Int instance Coercible Int Age
and defining datatypes also creates instances. This looks like a user-visible language feature to me, and I think it should be documented in the manual.
unsafeCoerce, rightly, need not be, because it's just a perfectly ordinary function with a rather extraordinary type.
Richard
On Sep 15, 2013, at 5:00 PM, Roman Cheplyaka
Could you explain why you think it's a language feature? We have plenty of "magic" stuff like unsafePerformIO, unsafeCoerce, or StableNames, which are not documented in the manual.
Just curious.
Roman
* Richard Eisenberg
[2013-09-15 16:48:16-0400] Very cool!
In the feature as pushed, is it possible to use coerce on any old newtype? If so, then it really is a language feature and probably should go into the manual, if `coerce` is exposed.
What was the end result of the discussion on abstraction? Can a library control how its types are coerced?
Richard
On Sep 13, 2013, at 6:13 PM, Joachim Breitner
wrote: Hi,
Am Montag, den 09.09.2013, 11:26 -0500 schrieb Austin Seipp:
It sounds like Simon thinks your work is good to go, so when your tree is clean, feel free to push.
done!
Given that in the final form the feature, to the user, looks like a library and not a language extension, I decided to put the documentation not in the users guide, but only in the haddock for coerce and Coercible.
So far they only live in GHC.Prim. Should we expose them in GHC.Prim for 7.8, or only in 7.10?
Greetings, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs