[Haskell-cafe] opengl type confusion

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Mon Jun 17 09:05:32 CEST 2013


On Sun, Jun 16, 2013 at 05:22:59PM -0700, briand at aracnet.com wrote:
> > Vertex3 takes three arguments, all of which must be of the same instance of
> > VertexComponent.  Specifying GLdoubles in the signature of wireframe
> > specifies the types in the last three calls to Vertex3, but (0.0 ::
> > GLdouble) is still requried on the first to fix the type there.  How else
> > could the compiler know that you mean 0.0 to be a GLdouble and not a
> > GLfloat?
> 
> it's curious that 
> 
> (0.0::GLdouble) 0.0 0.0 
> 
> is good enough and that 
> 
> (0.0::GLdouble) (0.0::GLdouble) (0.0::GLdouble)
> 
> is not required.  I suspect that's because, as you point out, they all
> have to be the same argument and ghc is being smart and saying if the
> first arg _must_ be GLdouble (because I'm explicitly forcing the type),
> then the rest must be too.

That is exactly the reason.

Tom



More information about the Haskell-Cafe mailing list