Hi,

Am Dienstag, den 23.07.2013, 09:51 +0100 schrieb Richard Eisenberg:
> A few responses:
> 
> - As Simon said, there is no great reason we don't have ~R# in Core. 
> It's just that we looked through GHC and, without newtype coercions, 
> there is no need for ~R#, so we opted not to include it. I'm still not 
> convinced we need it for newtype coercions, though. What if we have this 
> in Core?
> 
> > class NT a b = MkNT { castNT :: a -> b ; uncastNT :: b -> a }
> > NTCo:Age :: Age ~R# Int         -- see [1]
> > NTAgeInst :: NT Age Int
> > NTAgeInst = MkNT { castNT = \(a :: Age). a |> NTCo:Age ; uncastNT = \(x 
> > :: Int). x |> sym NTCo:Age }

I thought about this class definition, and it is has the nice property
that we can actually implement the methods by hand (without the
zero-cost of course), which would be a good lint-like check that we do
not generate illegal instances. The problem is that It it would not
allow
deriving instance NT a b => NT [a] [b]
as there is no way to extract the coercion that was used in the
implementation of NT a b. Hence the need to expose (to Core, not to tue
user) the coercion in the class: The cast operations do not compose
well.

Greetings,
Joachim

-- 
Joachim “nomeata” Breitner
  m...@joachim-breitner.de • http://www.joachim-breitner.de/
  Jabber: nome...@joachim-breitner.de  • GPG-Key: 0x4743206C
  Debian Developer: nome...@debian.org

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs

Reply via email to