【发布时间】:2015-08-05 18:26:05
【问题描述】:
我正在尝试在 PureScript 中创建一个外部常量,但它似乎没有调用该函数。
我在 PureScript 中:
module Test where
foreign import test :: String
foreign import test2 :: String -> String
在 JavaScript 中:
"use strict";
// module Test
exports.test = function() {
return "A";
};
exports.test2 = function(x) {
return x;
};
但它不调用外部函数:
> import Prelude
> :t test
Prim.String
> :t test2
Prim.String -> Prim.String
> test
undefined
> test2 "test"
"test"
> test ++ "A"
"function () {\n return \"A\";\n}A"
是否可以创建一个外部常量?还是所有函数都至少有一个参数?我正在使用:
$ pulp psci --version
0.7.0.0
【问题讨论】:
标签: javascript string constants purescript