xash / Array

Implements Arrays with a RRB-Tree backend in JavaScript for ELM.
BSD 3-Clause "New" or "Revised" License
7 stars 0 forks source link

Initialization Error on port : invalid 'instanceof' operand Array #2

Open ghost opened 10 years ago

ghost commented 10 years ago

Apparently Array overrides the Javascripts default Array type which causes an error in elm. I'm trying to initialize a port with a tuple.

foo.elm

module MyFoo where

import Array

port fooPort : Signal (Int, Int)

main = plainText (show fooPort)

index.html

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="UTF-8"><title>foo</title>
        <script type="text/javascript" src="elm-runtime.js"></script>
        <script type="text/javascript" src="elm_dependencies/xashili-Array/0.2.2/Native/Array.js"></script>
        <script type="text/javascript" src="foo.js"></script>
    </head>
    <body>
        <script type="text/javascript">Elm.worker(Elm.MyFoo, { fooPort : [0, 0] } )</script>
    </body>
</html>
elm -m --script=elm_dependencies/xashili-Array/0.2.2/Native/Array.js --script=foo.js --runtime=elm-runtime.js --only-js foo.elm
xash commented 10 years ago

Thanks for reporting, never thought of trying this! As Arrays get into the standard library and this is kind of a compiler bug, I opened an issue there: https://github.com/elm-lang/Elm/issues/576