How to write this correct...

Adrian Hey ahey at iee.org
Sun Feb 22 10:49:12 EST 2004


On Sunday 22 Feb 2004 10:03 am, Hans Nikolaus Beck wrote:
> Hi,
>
> I have the following problem:
>
> Vertex3 ist defined as
>
> data Vertex3 a = Vertex3 a a a
>
> a is defined as
>
> class a VertexComponent
>
> But I fail to write to following correct
>
> type GLVertex = (GLfloat, GLfloat, GLfloat)
>
> toVertex :: GLVertex -> Vertex3 a <<<<<<<< how do it correctly
> toVertex (x,y,z) = Vertex3 x y z
>
> The compiler says "cannot infer a with type GLFloat" or something like
> this.... I don't understand.
>
> Thank you for help

The type signature is wrong. Try this..
 toVertex :: GLVertex -> Vertex3 GLfloat

or perhaps..
 toVertex :: (a,a,a) -> Vertex3 a

Regards
--
Adrian Hey



More information about the Glasgow-haskell-users mailing list