[HOpenGL] [Haskell-cafe] Merging the OpenGLRaw and gl packages

Sven Panne svenpanne at gmail.com
Thu Oct 1 16:54:42 UTC 2015


2015-10-01 11:01 GMT+02:00 Oliver Charles <ollie at ocharles.org.uk>:

> [...] However, it's a lot more significant if you want to do something
> like:
>
> foo x = doSomething (case x of ...)
>
> Without pattern synonyms, you either have
>
> foo x = doSomething x'
>   where x' | x == ... = ...
>
> or
>
> {-# LANGUAGE MultiWayIf #-}
>
> foo x = doSomething (if | x == ... -> ...)
>

Or simply in plain old Haskell (basically the desugaring of the
multi-way-if):

   foo x = doSomething (case () of
                                     _ | x == gl_BAR -> expr1
                                        | x == gl_BAZ -> expr2
                                        | otherwise -> expr3)

Compared to:

   foo x = doSomething (case x of
                                      GL_BAR -> expr1
                                      GL_BAZ -> expr2
                                      _ .> expr3)

it doesn't really look *that* much different IMHO, given the high price one
has to pay for a tiny improvement in readability. But that's my personal,
more conservative view of things, and I'm here to see what other people
prefer.Alas, up to now, this is not very conclusive... :-/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/hopengl/attachments/20151001/edb168c9/attachment.html>


More information about the HOpenGL mailing list