More GND + role inference woes

Ben Gamari bgamari.foss at gmail.com
Sat Dec 14 21:52:34 UTC 2013


Edward Kmett <ekmett at gmail.com> writes:

> If this forced me to write those instances by hand, I could accept
> that as a tax for correctness. It means you can't GND any of the
> HasFoo dictionaries that lens builds, but meh.
>
Am I correct in assuming that Bind, R1, R2, R3, and R4 are the
problematic instances in linear? With recent GHC I get the errors below.

Cheers,

- Ben


    src/Linear/Affine.hs:112:34:
        Could not coerce from ‛f (f a)’ to ‛f (Point f a)’
          because ‛f (f a)’ and ‛f (Point f a)’ are different types.
          arising from the coercion of the method ‛join’ from type
                       ‛forall a. f (f a) -> f a’ to type
                       ‛forall a. Point f (Point f a) -> Point f a’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (Bind (Point f))
    
    src/Linear/Affine.hs:112:58:
        Could not coerce from ‛g (f x)’ to ‛g (Point f x)’
          because ‛g (f x)’ and ‛g (Point f x)’ are different types.
          arising from the coercion of the method ‛core’ from type
                       ‛forall a.
                        ((forall (g :: * -> *) x.
                          Functor g =>
                          (x -> g x) -> f x -> g (f x))
                         -> a)
                        -> f a’
                       to type
                       ‛forall a.
                        ((forall (g :: * -> *) x.
                          Functor g =>
                          (x -> g x) -> Point f x -> g (Point f x))
                         -> a)
                        -> Point f a’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (Core (Point f))
    
    src/Linear/Affine.hs:112:64:
        Could not coerce from ‛f1 (f a)’ to ‛f1 (Point f a)’
          because ‛f1 (f a)’ and ‛f1 (Point f a)’ are different types.
          arising from the coercion of the method ‛_x’ from type
                       ‛forall a (f :: * -> *). Functor f => (a -> f a) -> f a -> f (f a)’
                       to type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (a -> f a) -> Point f a -> f (Point f a)’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (R1 (Point f))
    
    src/Linear/Affine.hs:112:68:
        Could not coerce from ‛f1 (f a)’ to ‛f1 (Point f a)’
          because ‛f1 (f a)’ and ‛f1 (Point f a)’ are different types.
          arising from the coercion of the method ‛_xy’ from type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (V2 a -> f (V2 a)) -> f a -> f (f a)’
                       to type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (V2 a -> f (V2 a)) -> Point f a -> f (Point f a)’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (R2 (Point f))
    
    src/Linear/Affine.hs:112:68:
        Could not coerce from ‛f1 (f a)’ to ‛f1 (Point f a)’
          because ‛f1 (f a)’ and ‛f1 (Point f a)’ are different types.
          arising from the coercion of the method ‛_y’ from type
                       ‛forall a (f :: * -> *). Functor f => (a -> f a) -> f a -> f (f a)’
                       to type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (a -> f a) -> Point f a -> f (Point f a)’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (R2 (Point f))
    
    src/Linear/Affine.hs:112:72:
        Could not coerce from ‛f1 (f a)’ to ‛f1 (Point f a)’
          because ‛f1 (f a)’ and ‛f1 (Point f a)’ are different types.
          arising from the coercion of the method ‛_xyz’ from type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (V3 a -> f (V3 a)) -> f a -> f (f a)’
                       to type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (V3 a -> f (V3 a)) -> Point f a -> f (Point f a)’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (R3 (Point f))
    
    src/Linear/Affine.hs:112:72:
        Could not coerce from ‛f1 (f a)’ to ‛f1 (Point f a)’
          because ‛f1 (f a)’ and ‛f1 (Point f a)’ are different types.
          arising from the coercion of the method ‛_z’ from type
                       ‛forall a (f :: * -> *). Functor f => (a -> f a) -> f a -> f (f a)’
                       to type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (a -> f a) -> Point f a -> f (Point f a)’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (R3 (Point f))
    
    src/Linear/Affine.hs:112:76:
        Could not coerce from ‛f1 (f a)’ to ‛f1 (Point f a)’
          because ‛f1 (f a)’ and ‛f1 (Point f a)’ are different types.
          arising from the coercion of the method ‛_xyzw’ from type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (V4 a -> f (V4 a)) -> f a -> f (f a)’
                       to type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (V4 a -> f (V4 a)) -> Point f a -> f (Point f a)’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (R4 (Point f))
    
    src/Linear/Affine.hs:112:76:
        Could not coerce from ‛f1 (f a)’ to ‛f1 (Point f a)’
          because ‛f1 (f a)’ and ‛f1 (Point f a)’ are different types.
          arising from the coercion of the method ‛_w’ from type
                       ‛forall a (f :: * -> *). Functor f => (a -> f a) -> f a -> f (f a)’
                       to type
                       ‛forall a (f :: * -> *).
                        Functor f =>
                        (a -> f a) -> Point f a -> f (Point f a)’
        Possible fix:
          use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
        When deriving the instance for (R4 (Point f))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20131214/62f365fe/attachment.sig>


More information about the ghc-devs mailing list