Functional programming purescript入门
我刚开始学习purescript,但是我在最后一个阶段被卡住了。 我按照说明操作,但当我运行grunt命令时,会出现以下错误:Functional programming purescript入门,functional-programming,ffi,purescript,Functional Programming,Ffi,Purescript,我刚开始学习purescript,但是我在最后一个阶段被卡住了。 我按照说明操作,但当我运行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.rand
/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成为本机,并使用节点index.js
运行主index.js
,一切都会正常工作。
我想知道我是否可以在purescript中做些什么来修复这个问题,或者是我做错了什么。最新版本中的
purescript random
模块在与psc make
一起使用时出现故障。它将在下一个版本0.6.7中由编译器补丁修复,希望在本周
作为一种解决方法,您应该能够在bower.json
文件中或在命令行中指定以前版本的purescript random
:
bower install purescript-random#0.1.1
为什么要贴标签?PureScript确实与Haskell有关,PureScript编译器是用Haskell编写的,但它们不是同一种语言。我现在删除了Haskell标记,我最初添加它是因为许多其他PureScript问题都在使用这种组合。这太棒了,非常感谢:)期待着很快开始在生产代码中使用PureScript
bower install purescript-random#0.1.1