Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

"type instance V (Point v) = v" is not visible without explicit import. #17

Closed
fryguybob opened this Issue Aug 4, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Owner

fryguybob commented Aug 4, 2012

(Imported from http://code.google.com/p/diagrams/issues/detail?id=65. Original issue from mgsl...@gmail.com on January 23, 2012, 04:01:35 AM UTC)

What steps will reproduce the problem?

  1. Use GHC 7.2.1
  2. Write an expression which depends on V (Point (V a)) = V a, such as "transform (translation zeroV)"

Prelude Diagrams.Prelude> :t transform (translation zeroV) . P
transform (translation zeroV) . P
:: (Data.MemoTrie.HasTrie (Data.Basis.Basis a),
Data.MemoTrie.HasTrie (Data.Basis.Basis (V (Point a))),
Data.Basis.HasBasis a,
Data.Basis.HasBasis (V (Point a))) =>
a -> Point a
Prelude Diagrams.Prelude> :m + Graphics.Rendering.Diagrams.Points
Prelude Diagrams.Prelude Graphics.Rendering.Diagrams.Points> :t transform (translation zeroV) . P
transform (translation zeroV) . P
:: (Data.MemoTrie.HasTrie (Data.Basis.Basis a),
Data.Basis.HasBasis a) =>
a -> Point a

Owner

fryguybob commented Aug 4, 2012

(Imported. Original comment by byor...@gmail.com on January 23, 2012, 12:44:41 PM UTC)

Another way to reproduce this:

Prelude Diagrams.Prelude> :type (\x -> (x :: V (Point (Double,Double)))) (4,5)

:1:9:
Couldn't match type V (Point (Double, Double))' with(t0, t1)'
In the expression: (x :: V (Point (Double, Double)))
In the expression: \ x -> (x :: V (Point (Double, Double)))
In the expression:
(\ x -> (x :: V (Point (Double, Double)))) (4, 5)
Prelude Diagrams.Prelude> :m +Graphics.Rendering.Diagrams.Points
Prelude Diagrams.Prelude Graphics.Rendering.Diagrams.Points> :type (\x -> (x :: V (Point (Double,Double)))) (4,5)
(\x -> (x :: V (Point (Double,Double)))) (4,5) :: (Double, Double)

It seems this is likely a GHC bug, but I'd like to keep the ticket open here until we figure out a minimal test case to file as a GHC bug (or find an existing ticket).

I first encountered this problem when I split out most of the content of Graphics.Rendering.Diagrams.Points into the vector-space-points package. Currently the V instance is the only thing in the module.

Note that other V instances are defined in other modules and are re-exported via Diagrams.Prelude just fine. It's a mystery why the instance for Point is not.

Owner

byorgey commented Dec 30, 2012

This seems to have been fixed in GHC 7.6.1; closing.

@byorgey byorgey closed this Dec 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment