Re: Help with coercion & roles?

2014-04-14 Thread Conal Elliott
uire a nominal parameter, the newtype would expect a >>> representational coercion, not the nominal one you are passing. Check the >>> dump (using -ddump-tc) of the newtype axiom to be sure. >>> >>> Though putting a `Sub` on `` and changing the Refl constructor on >

Re: Help with coercion & roles?

2014-04-14 Thread Richard Eisenberg
o tc ...` over `AppCo (Refl >> (TyConApp tc [])) ...`. >> >> In sum, here is the coercion I think you want: >> >> (LambdaCCC.Lambda.EP (Sym (Simple.NTCo:HasIf[0] _R)))_R >> >> This is one of the problems with roles -- they are *very* fiddly within GHC, >>

Re: Help with coercion & roles?

2014-04-14 Thread Conal Elliott
ple.NTCo:HasIf[0] _R)))_R >> >> This is one of the problems with roles -- they are *very* fiddly within >> GHC, and it's hard for a non-expert in roles to get them right. >> >> Have you seen docs/core-spec/core-spec.pdf? That is updated w.r.t. roles >> and m

Re: Help with coercion & roles?

2014-04-14 Thread Richard Eisenberg
t. roles and > may be of help. > > Let me know if I can help further! > Richard > > On Apr 14, 2014, at 5:45 AM, Simon Peyton Jones wrote: > >> I think you need a ‘Sub’. >> >> A cast (e `cast` g) requires a representational coercion. I think you have >&

Re: Help with coercion & roles?

2014-04-14 Thread Conal Elliott
t; > A cast (e `cast` g) requires a representational coercion. I think you > have given it a (stronger) nominal one. Sub gets from one to t’other. > > Simon > > *From:* Glasgow-haskell-users [mailto:glasgow- > haskell-users-boun...@haskell.org] *On Behalf Of *Conal Elliott > *

Re: Help with coercion & roles?

2014-04-14 Thread Richard Eisenberg
-users > [mailto:glasgow-haskell-users-boun...@haskell.org] On Behalf Of Conal Elliott > Sent: 14 April 2014 06:00 > To: ghc-devs@haskell.org; glasgow-haskell-us...@haskell.org > Subject: Help with coercion & roles? > > I’m working on a GHC plugin (as part of my Haskell-to-hard

RE: Help with coercion & roles?

2014-04-14 Thread Simon Peyton Jones
April 2014 06:00 To: ghc-devs@haskell.org; glasgow-haskell-us...@haskell.org Subject: Help with coercion & roles? I’m working on a GHC plugin (as part of my Haskell-to-hardware work) and running into trouble with coercions & roles. Error message from Core Lint: Warning: In the ex

Help with coercion & roles?

2014-04-13 Thread Conal Elliott
I’m working on a GHC plugin (as part of my Haskell-to-hardware work) and running into trouble with coercions & roles. Error message from Core Lint: Warning: In the expression: LambdaCCC.Lambda.lamvP# @ (GHC.Types.Bool → GHC.Types.Bool → GHC.Types.Bool → GHC.Types.Bool) @ (Simple.HasIf G