[Haskell-cafe] Merging the OpenGLRaw and gl packages

Sven Panne svenpanne at gmail.com
Wed Sep 30 17:38:26 UTC 2015


2015-09-30 17:02 GMT+02:00 Casey McCann <cam at uptoisomorphism.net>:

> On Wed, Sep 30, 2015 at 10:29 AM, Sven Panne <svenpanne at gmail.com> wrote:
> >   * Should OpenGLRaw use pattern synonyms? (Probably yes, but note that
> this
> > implies GHC >= 7.8.1)
> >
> >   * Should OpenGLRaw use the 'Half' type from the 'half' package?
> (Probably
> > yes, but again this implies GHC 7.8.1)
>
> 7.8.1 is, what, a year and a half old?
>
> I'm all for bleeding edge personally but not everyone feels that way,
> and that seems pretty severe relative to the benefits.
>

That's my biggest concern, too, and that's why I wanted to hear other
people's opinions: IMHO using pattern synonyms vs. plain old Haskell values
is to a large part just bikeshedding, at least in the trivial case at hand
where we talk about simple integral values. It basically boils down to the
question: Is

   foo x = case x of
     GL_BAR -> expr1
     GL_BAZ -> expr2
     _ -> expr3

really so much better than

   foo x
     | x == GL_BAR = expr1
     | x == GL_BAZ = expr2
     | otherwise = expr3

that we want to drop support for GHC < 7.8.1? Personally, I'm not
convinced, but if most other people think that it's OK, I'm willing to pay
the price for the sake of merging the packages. Edward claims that using
pattern synonyms will result in more efficient code, too, but I haven't
checked that. And even if it was: Perhaps GHC can be tweaked to treat both
versions above in the same way (I can see no reason why this shouldn't be
possible, but perhaps I'm wrong). Regarding readability: The version with
pattern synonyms *is* slightly more readable, but not so much that it would
warrant dropping slightly outdated GHCs.

Regarding the 'half' package: I've just seen that it should work with any
GHC 7.x now, so this decision can be decoupled from the pattern synonym
issue. Perhaps I should release a new, only slightly incompatible OpenGLRaw
version using 'half'? Although GLhalf is part of OpenGL core since 3.0, it
is only used in very few non-central places (GL_ARB_half_float_pixel,
GL_ARB_half_float_vertex, and GL_NV_half_float). So the resulting breakage
will probably be very low.

Regarding the module prefix: I'm not sure if it's worth making this
breaking change alone, probably this should only be done in conjunction
with the introduction of pattern synonyms. But other opinions would be
valuable here, too.

[...] As an aside regarding the wiki discussion, I don't really see how
> there's a sane way to have a combined low-level API for WebGL and full
> OpenGL. [...]


As already mentioned in more detail on the Wiki, the plan to combine OpenGL
and WebGL in a single package is doomed: Different values for the same
token, different contents of the extensions, different ways to retrieve the
entry points. It's a pity, but that's how it is...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150930/f8a31548/attachment.html>


More information about the Haskell-Cafe mailing list