I don't want to use the GL types directly since the OpenGL renderer is not
exposes in the rest of the API.
I was hoping that realToFrac would be a nop in case it would be identical to
an unsafeCoerce.

I guess one could make rules for that, but this tickets makes me wander if
that really works:
http://hackage.haskell.org/trac/ghc/ticket/1434



On Wed, Sep 30, 2009 at 4:58 PM, Roel van Dijk <[email protected]>wrote:

> If you are *really* sure that the runtime representation is the same
> you could use usafeCoerce. You could use a small test function for
> profiling, something like:
>
> convertGLfloat :: GLfloat -> Float
> convertGLFloat = realToFrac
> -- convertGLFloat = unsafeCoerce
>
> and toggle between the two (assuming you won't get a segmentation fault).
>
> Another option is to not convert at all but use the GL types
> everywhere. Either explicitly or by exploiting polymorphism.
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to