elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 657 forks source link

Could not find type constructor `WebGL.Shader` #1557

Open Zinggi opened 7 years ago

Zinggi commented 7 years ago

When trying to compile examples for my .obj file loader I ran into a strange issue:

elm-make: Could not find type constructor `WebGL.Shader` while checking types.
elm-make: thread blocked indefinitely in an MVar operation

After some investigations, I managed to reduce it into the following two files:

SSCCE

Needs two files (Main.elm and Shaders.elm)

Main.elm

module Main exposing (..)

import Html exposing (Html)
import Shaders

main =
    Html.text ""

Shaders.elm

module Shaders exposing (..)

frag =
    [glsl|

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

elm-package.json

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-community/linear-algebra": "1.0.0 <= v < 2.0.0",
        "elm-community/webgl": "2.0.0 <= v <= 3.0.0",
        "elm-lang/core": "5.0.0 <= v < 6.0.0",
        "elm-lang/html": "2.0.0 <= v < 3.0.0"
    },
    "elm-version": "0.18.0 <= v < 0.19.0"
}

Steps to reproduce

Try to compile Main.elm: elm make Main.elm

Workarounds

Variant 1

Create a new file Test.elm.

module Test exposing (..)

import Html

main = Html.text "test"

compile it: elm make Test.elm

The previous error vanished, elm make Main.elm now succeeds.

Variant 2

This is more obvious:

Add import WebGL at the top of Shaders.elm

Now compiling works.

OS browser Elm version
arch linux NA elm-make 0.18 (Elm Platform 0.18.0)
process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

marrony commented 7 years ago

related https://github.com/elm-lang/elm-compiler/issues/1322