簡體   English   中英

purescript入門

[英]Getting started with purescript

我只是通過示例跟隨純腳本開始學習purescript 但是使用grunt項目模板將我困在第二的結尾。 我遵循了說明,但是當我運行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();
}
;

如果我刪除了進口,讓數學成為本土和運行主index.js簡單地與node index.js ,一切工作正常。 我想知道是否有什么辦法可以解決此問題,或者我做錯了什么。

當與psc-make一起使用時, purescript-random模塊在最新版本中已損壞。 希望在本周的下一個版本0.6.7中通過編譯器補丁對其進行修復。

解決方法是,您應該能夠在bower.json文件中或在命令行上指定purescript-random的先前版本:

bower install purescript-random#0.1.1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM