Re: Help with coercion & roles?

2014-04-14 Thread Conal Elliott
This explanation-with-example is very helpful. Thanks, Richard! I'll noodle some more. A fairly simple & robust solution may be to add `Cast` to my expression GADT. -- Conal On Mon, Apr 14, 2014 at 2:02 PM, Richard Eisenberg wrote: > So what do you think? Is there a sound coercion I can build f

Re: Help with coercion & roles?

2014-04-14 Thread Richard Eisenberg
> So what do you think? Is there a sound coercion I can build for `co'`? In a word, "no". The problem is that E, as you describe, is a GADT. Therefore, it cares exactly which types it is parameterized by. We can see this in evidence in the dump, which labels E's second parameter as nominal. To

Re: Help with coercion & roles?

2014-04-14 Thread Conal Elliott
Hi Richard, I'm working on compiling Haskell to hardware, as outlined at https://github.com/conal/lambda-ccc/blob/master/doc/notes.md (with links to a few recent blog posts). The first step is to convert Core into other Core that evaluates to a reified form, represented as a type-parametrized GADT

Re: Help with coercion & roles?

2014-04-14 Thread Richard Eisenberg
Hi Conal, In your case, the `_N` on the argument to NTCo:HasIf[0] is correct -- the `HasIf` class indeed has a nominal parameter. So, it seems that this part, at least, is OK. What's the -ddump-tc on EP? Is EP's role nominal? (I think so, given what you're saying.) If that's the case, you won'

Re: Help with coercion & roles?

2014-04-14 Thread Conal Elliott
Thanks for the pointers! I don't quite know how to get to the form you recommend from the existing coercion, which is `Simple.NTCo:HasIf[0] _N`. (Note the `_N`.) I got that coercion in GHC 7.8.2 from the following code: > class HasIf a where > ifThenElse :: Bool -> a -> a -> a > > instance HasIf

Fwd: Using Cabal to install terminfo-0.4.0.0 breaks GHC on Debian x86_64

2014-04-14 Thread Ramin Honary
Hi, thanks for your reply. Yes, I know for a fact I was installing to the global registry. All of my Haskell projects depend on a few important packages, and I always install these globally. For stuff I just want to play around with, I just install into the user registry. Actually terminfo-0.4.0.0

Re: -optl behavior in ghc-7.8.1

2014-04-14 Thread Brandon Allbery
On Mon, Apr 14, 2014 at 10:42 AM, Simon Marlow wrote: > The problem I was fixing was that we weren't always passing the -optl > options. Now when we invoke a program the -optXXX options always come > first - I think before it was kind of random and different for each of the > phases. > Some thi

Re: -optl behavior in ghc-7.8.1

2014-04-14 Thread Simon Marlow
On 10/04/2014 18:11, Yuras Shumovich wrote: On Thu, 2014-04-10 at 18:49 +0200, Karel Gardas wrote: On 04/10/14 06:39 PM, Yuras Shumovich wrote: ...and other linker options must come after, like in my case. So what? Are there any ticket where people complain about the old behavior? I'm not advoc

Re: Using Cabal to install terminfo-0.4.0.0 breaks GHC on Debian x86_64

2014-04-14 Thread Austin Seipp
Hi Ramin, Can I ask if you're installing packages into the global user database? If so, that's definitely the way for this to happen - otherwise, Cabal should never overwrite *anything* in the 'global' package directory (in your case, under /usr/local/lib/ghc-7.8.2...) This is the only way I can s

Re: Using Cabal to install terminfo-0.4.0.0 breaks GHC on Debian x86_64

2014-04-14 Thread Ramin Honary
I am using Debian, not Mac. It is possible the problem may be with the binary release for Debian x86_64, or it could just be my Cabal config file. When I install the binary distribution onto Debian, I simply run "make install" in the ghc-7.8.2 directory. I don't know how this install process the c

Re: Help with coercion & roles?

2014-04-14 Thread Richard Eisenberg
I agree with Simon, but just `Sub` the `_N`, not the whole coercion. There are actually two problems here. The one Simon identified, and also the fact that Simple.NTCo:HasIf[0] produces a representational coercion. How do I know? Because of the `NT` -- it's a newtype axiom and must produce rep

RE: Help with coercion & roles?

2014-04-14 Thread Simon Peyton Jones
I think you need a ‘Sub’. 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 Sent: 14 Apri