5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Elm 0.19でExtensible Recordの使い方によってはコンパイラが壊れる

5
Posted at

コンパイラのバグだが、こんな感じのエラーがでることがある

Dependencies loaded from local cache.
Dependencies ready!                
[==================================                ] - 18 / 26elm: Used toAnnotation on a type that is not well-formed
CallStack (from HasCallStack):
  error, called at compiler/src/Type/Type.hs:414:21 in main:Type.Type
[==============================================    ] - 24 / 26elm: thread blocked indefinitely in an MVar operation

これはelm-stuffを消しても治らない。

発現条件は、以下のようなExtensible Recordの使い方

type alias Hogeable a =
    { hoge : String }


hogehoge : Hogeable () -> String
hogehoge { hoge } =
    hoge

つまり、上のコードは下のように書き直せばよい

 type alias Hogeable a =
     { hoge : String }


+hogehoge : Hogeable a -> String
 hogehoge { hoge } =
     hoge

参考: https://github.com/elm/compiler/issues/1785

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?