More GND + role inference woes

Edward Kmett ekmett at gmail.com
Sun Oct 13 22:01:39 UTC 2013


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 <ekmett at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20131013/384f8905/attachment.html>


More information about the ghc-devs mailing list