Re: Merging the OpenGLRaw and gl packages

Sven Panne <[email protected]> Wed, 30 Sep 2015 19:38:26 +0200
Newsgroups gmane.comp.lang.haskell.cafe,gmane.comp.lang.haskell.hopengl
Message-ID <CANBN=mt-tWyE=t1gJ9_G2sZZH9KSJ58hRTeJpgW5knDFMLCsJg@mail.gmail.com>
--===============1117508431932266853==
Content-Type: multipart/alternative; boundary=001a1146607cdd0b1c0520fa654b

--001a1146607cdd0b1c0520fa654b
Content-Type: text/plain; charset=UTF-8

2015-09-30 17:02 GMT+02:00 Casey McCann <[email protected]>:

> On Wed, Sep 30, 2015 at 10:29 AM, Sven Panne <[email protected]> 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...

--001a1146607cdd0b1c0520fa654b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2015=
-09-30 17:02 GMT+02:00 Casey McCann <span dir=3D"ltr">&lt;<a href=3D"mailto=
:[email protected]" target=3D"_blank">[email protected]</a>&gt;=
</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-s=
tyle:solid;padding-left:1ex"><span class=3D"">On Wed, Sep 30, 2015 at 10:29=
 AM, Sven Panne &lt;<a href=3D"mailto:[email protected]">svenpanne@gmail.=
com</a>&gt; wrote:<br>
&gt;=C2=A0 =C2=A0* Should OpenGLRaw use pattern synonyms? (Probably yes, bu=
t note that this<br>
&gt; implies GHC &gt;=3D 7.8.1)<br>
&gt;<br>
&gt;=C2=A0 =C2=A0* Should OpenGLRaw use the &#39;Half&#39; type from the &#=
39;half&#39; package? (Probably<br>
&gt; yes, but again this implies GHC 7.8.1)<br>
<br>
</span>7.8.1 is, what, a year and a half old?<br>
<br>
I&#39;m all for bleeding edge personally but not everyone feels that way,<b=
r>
and that seems pretty severe relative to the benefits.<br></blockquote><div=
><br></div><div>That&#39;s my biggest concern, too, and that&#39;s why I wa=
nted to hear other people&#39;s opinions: IMHO using pattern synonyms vs. p=
lain old Haskell values is to a large part just bikeshedding, at least in t=
he trivial case at hand where we talk about simple integral values. It basi=
cally boils down to the question: Is</div><div><br></div><div>=C2=A0 =C2=A0=
foo x =3D case x of</div><div>=C2=A0 =C2=A0 =C2=A0GL_BAR -&gt; expr1</div><=
div>=C2=A0 =C2=A0 =C2=A0GL_BAZ -&gt; expr2</div><div>=C2=A0 =C2=A0 =C2=A0_ =
-&gt; expr3</div><div><br></div><div>really so much better than</div><div><=
br></div><div>=C2=A0 =C2=A0foo x</div><div>=C2=A0 =C2=A0 =C2=A0| x =3D=3D G=
L_BAR =3D expr1</div><div><div>=C2=A0 =C2=A0 =C2=A0| x =3D=3D GL_BAZ =3D ex=
pr2</div></div><div>=C2=A0 =C2=A0 =C2=A0| otherwise =3D expr3</div><div><br=
></div><div>that we want to drop support for GHC &lt; 7.8.1? Personally, I&=
#39;m not convinced, but if most other people think that it&#39;s OK, I&#39=
;m willing to pay the price for the sake of merging the packages. Edward cl=
aims that using pattern synonyms will result in more efficient code, too, b=
ut I haven&#39;t checked that. And even if it was: Perhaps GHC can be tweak=
ed to treat both versions above in the same way (I can see no reason why th=
is shouldn&#39;t be possible, but perhaps I&#39;m wrong). Regarding readabi=
lity: The version with pattern synonyms *is* slightly more readable, but no=
t so much that it would warrant dropping slightly outdated GHCs.</div><div>=
<br></div><div>Regarding the &#39;half&#39; package: I&#39;ve just seen tha=
t it should work with any GHC 7.x now, so this decision can be decoupled fr=
om the pattern synonym issue. Perhaps I should release a new, only slightly=
 incompatible OpenGLRaw version using &#39;half&#39;? Although GLhalf is pa=
rt 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.</div><div><br></div><=
div>Regarding the module prefix: I&#39;m not sure if it&#39;s worth making =
this breaking change alone, probably this should only be done in conjunctio=
n with the introduction of pattern synonyms. But other opinions would be va=
luable here, too.</div><div><br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(=
204,204,204);border-left-style:solid;padding-left:1ex">[...] As an aside re=
garding the wiki discussion, I don&#39;t really see how<br>
there&#39;s a sane way to have a combined low-level API for WebGL and full<=
br>
OpenGL. [...]</blockquote><div><br></div><div>As already mentioned in more =
detail on the Wiki, the plan to combine OpenGL and WebGL in a single packag=
e is doomed: Different values for the same token, different contents of the=
 extensions, different ways to retrieve the entry points. It&#39;s a pity, =
but that&#39;s how it is...</div></div></div></div>

--001a1146607cdd0b1c0520fa654b--

--===============1117508431932266853==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

--===============1117508431932266853==--