Lesser known syntax

Didn’t know about this until the Rubiks cube thread:

Elm can also parse GLSL shaders and has special syntax for handling them:

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

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

http://package.elm-lang.org/packages/elm-community/webgl/2.0.5/

2 Likes