Closed conal closed 7 years ago
Hi Conal,
Thanks a lot for the bug report and the PR! I've published the fixed package as version 0.2.1 to Hackage.
Thu
Hi Thu. You're very welcome. Thanks for the quick merge and Hackage release, and thanks for language-glsl! I'm using it to help translate Haskell to GLSL, as part of my work on compiling to categories. This part of the project aims at reproducing Pan, Vertigo, and Eros in a much simpler way, with a nicer programming interface. It will combine categories for GLSL code generation, GUIs, and differentiable functions (for lighting).
Here's hoping you won't have too many problems with it; as you saw that library is quite rough and doesn't receive a lot of attention.
@noteed I'm now using language-glsl-0.2.1 from Hackage in my project. Works fine. Thanks again.
@conal is that project OSS? It may duplicate/replace my current work in that area so I'd like to follow along :)
@schell Yes; the project I mentioned is OSS. See concat. The general scheme for non-standard compilation of Haskell programs is described in Compiling to Categories.
Thanks @conal :)
The
prettyBinary
function inLanguage.GLSL.Pretty
sometimes incorrectly omits parentheses. For instance,(/)
is left-associative, so "a / b / c" parses as "(a / b) / c", i.e.,and "a / (b / c)" parses as
However, pretty-printing this last expression yields "a / b / c", which is incorrect.
The problematic code:
To fix this bug, tweak the precedence context when pretty-printing the argument expressions, depending on the operator's associative:
I submitted a pull request.