2

例によって purescript に続いてpurescriptの学習を始めたばかりですが、Chapter2の最後でgrunt project templates を使用して立ち往生しています。指示に従いますが、grunt コマンドを実行すると、次のエラーが発生します。

/Users/chad/playground/purescript/tests/tmp/node_modules/Control.Monad.Eff.Random/index.js:8
return Math.random();
            ^
TypeError: undefined is not a function
    at Object.random (/Users/chad/playground/purescript/tests/tmp/node_modules/Control.Monad.Eff.Random/index.js:8:17)
    at __do (/Users/chad/playground/purescript/tests/tmp/node_modules/Test.QuickCheck/index.js:177:52)
    at Object.__do (/Users/chad/playground/purescript/tests/tmp/node_modules/Main/index.js:19:201)
    at Object.<anonymous> (/Users/chad/playground/purescript/tests/tmp/index.js:1:79)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
Warning: -> error 1 /Users/chad/playground/purescript/tests/tmp/index.js (125ms) Use --force to continue.

Aborted due to warnings.

コードを掘り下げて発見したのは、モジュールMathが次のようにインポートさ/output/Control.Monad.Eff.Random/index.jsれることです

var Math = require("Math");

function random() {
    return Math.random();
}
;

インポートを削除して、Math をネイティブにし、メインを で実行するindex.jsnode index.js、すべて正常に動作します。これを純粋なスクリプトで修正するためにできることがあるかどうか、それとも私が間違っていることであるかどうか疑問に思っていました。

4

1 に答える 1

5

purescript-randomで使用すると、最新のリリースでモジュールが破損しますpsc-make。これは、次のリリース 0.6.7 のコンパイラ パッチによって修正される予定です。

purescript-random回避策として、bower.jsonファイルまたはコマンド ラインでの以前のバージョンを指定できるようにする必要があります。

bower install purescript-random#0.1.1
于 2015-02-12T04:39:05.280 に答える