Yuck.

But, many, many thanks for discovering this now instead of later.

For various silly reasons, I didn't have a platform (i.e. a recent enough HEAD 
in the right state, etc.) for me to explore this today (Monday). But, I should 
have the time and ability to look closer on Tuesday.

If it's really as bad as you say, we'll need to think carefully about how to 
proceed. I have various thoughts about how to fix the problem, but none would 
be ready for 7.8 by a long shot. So, do we issue warnings (that a GND, or 
perhaps a use of `coerce` might not be safe) in 7.8? How would a user disable 
these warnings?

Anyway, more tomorrow.

Richard

On Oct 13, 2013, at 6:01 PM, Edward Kmett <ekm...@gmail.com> wrote:

> I didn't think I was using GND much at all, but apparently I was wrong.
> 
> After Ben's initial foray into building linear, I went and looked at the 
> other applications of GeneralizedNewtypeDeriving in my code and found that in 
> parsers, all of the derived instances for the supplied parser transformers 
> fail.
> 
> This also affects any attempt to use GND to do deriving for any monad 
> transformer stack that isn't fully instantiated to concrete terms. This is 
> actually a very common idiom to avoid writing boilerplate on top of 
> transformers:
> 
> newtype T m a = T { runT : StateT MyState (ReaderT MyEnv) m a }
>   deriving (Functor, Monad, Applicative, MonadState MyState, MonadReader 
> MyEnv, ...)
> 
> As I rummage through more of my code, I actually can't find any instances of 
> GND that do still work that aren't of the form:
> 
> newtype Foo a = Foo { runFoo :: a } deriving ...
> 
> Literally every other example I have of GND in the code I maintain has 
> something in it that causes it to run afoul of the new roles machinery.
> 
> I'd say the problem is more widespread than we thought.
> 
> -Edward
> 
> 
> On Sun, Oct 13, 2013 at 5:26 PM, Edward Kmett <ekm...@gmail.com> wrote:
> Ben Gamari was trying to update my linear package to work with GHC HEAD.
> 
> Along the way he noted an example of the new GND+role inference machinery 
> failing rather spectacularly.
> 
> http://hackage.haskell.org/package/linear-1.3/docs/src/Linear-Affine.html#Point
> 
> Note the number of classes that the current proposal would force us to hand 
> implement. 
> 
> =(
> 
> -Edward
> 

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

Reply via email to