Open sourcing the Rubik's cube game

This is super cool!

A quick question about the WebGL package, and some of the syntax:

fragmentShader : Shader {} Uniforms {}
fragmentShader =
    [glsl|
        precision mediump float;
        uniform vec3 color;

        void main () {
          gl_FragColor = vec4(color, 1.0);
        }
    |]

So what exactly is going on in the value of this declaration? Is this valid elm syntax here? Is there a step before the Elm compiler that replaces this with something else? Or is [glsl| some kind of special Elm syntax that the compiler actually understands? Are other languages understood here? ([js| /* ... */ |], etc.).

I’ve never seen anything like this before. I didn’t see any explanation for this, so I was wondering if anyone could explain how this works. Thanks!

1 Like