我是OCaml的新手,我正试图尝试(:P)Facebook Reason语法.我无法找到一种方法来进行编译,因为如果找不到Core模块(已经安装了opam).
我正在尝试从Real World OCaml编译一个示例程序
open Core.Std;
let rec read_and_accumulate accum => {
let line = In_channel.input_line In_channel.stdin;
switch line {
| None => accum
| Some x => read_and_accumulate (accum +. Float.of_string x)
}
};
let () = printf "Total: %F\n" (read_and_accumulate 0.);
Run Code Online (Sandbox Code Playgroud)
这是我用于编译的命令:rebuild accum.native.
当我有这个_tags(来自https://janestreet.github.io/installation.html中的说明)
true: package(core,ppx_jane)
true: thread,debug
Run Code Online (Sandbox Code Playgroud)
我的错误发生了变化,但我仍然不知道该怎么做:
File "_tags", line 1, characters 6-28:
Warning: tag "package" does not expect a parameter, but is used with parameter "core,ppx_jane"
File "_tags", …Run Code Online (Sandbox Code Playgroud) 我正在使用 NPM 包react-hyperscript-helpers。当我导入它时,它会读取index.js并获取类型index.d.ts。然而,这些类型似乎已经过时了,因为我收到了很多这样的错误:
node_modules/react-hyperscript-helpers/lib/index.d.ts(546,53): error TS2314: Generic type 'HTMLAttributes<T>' requires 1 type argument(s).
我知道如何修复类型错误,但我当然无法编辑下面的文件,node_modules因为它会在下一个npm install.
如何忽略包含的.d.ts文件并使用我的文件?
我尝试忽略所有内容node_modules并tsconfig.json设置typings选项,但没有成功。这是该文件(如果有的话):
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"typeRoots" : ["./typings"]
},
"include": [
"typescript/**/*"
],
"exclude": [
"node_modules/**/*",
"node_modules/react-hyperscript-helpers/lib/*.ts"
]
}
Run Code Online (Sandbox Code Playgroud) exit从源文件执行的命令不会终止源程序的执行,如何执行此操作?考虑这个文件以获得更清晰的解释:
一条鱼:
source b.fish
echo "This should never run!"
Run Code Online (Sandbox Code Playgroud)
b.鱼:
echo "Failing now"
exit 1
Run Code Online (Sandbox Code Playgroud)
这将导致这个(不需要的输出):
Failing now
This should never run!
Run Code Online (Sandbox Code Playgroud)
退出状态为0!B 是否有解决方案可以终止 A 的执行,就像exit是写在 A 本身中一样?
如果我有一个定义数据类型的文件SimpleDuple,并在另一个定义另一个数据类型的文件中,DiscreetFilter我希望将一个属性values作为一个数组,SimpleDuple我将如何使用include?
考虑SimpleDuple的文件:
#%RAML 1.0 DataType
type: object
properties:
id: string
name: string
Run Code Online (Sandbox Code Playgroud)
我要创建属性的另一个定义是属性中的SimpleDuples数组values(但我必须使用内联定义).
#%RAML 1.0 DataType
type: object
properties:
field: string
name: string
type: { enum: [ discreet ] }
# Ideally this property would use an include
# in some way to express the equivalent of SimpleDuple[]
values:
type: array
properties:
id: string
name: string
Run Code Online (Sandbox Code Playgroud)
如果那两个类型在同一个文件中我将values属性设置为 SimpleDuple[].如果它不是数组,我会将include作为values属性的值.
但是如何同时使用include和数组而不是使用复制代码中使用的内联定义?
我知道运行一个期望环境完全工作的rake任务需要实际建立数据库连接.基本上,这就是为什么Heroku需要在加载环境之前运行资产管道预编译的原因.
这就是为什么需要这条线来将3.X应用程序部署到Cedar:
config.assets.initialize_on_precompile = false
Run Code Online (Sandbox Code Playgroud)
现在,我正在尝试构建一个自定义构建包,需要一个rake任务来执行其他资产编译,以使应用程序按预期工作.这是因为我有国际化的JS资产文件并使用https://github.com/fnando/i18n-js
我需要运行rake i18n:js:export,这需要环境.*在我可以添加此调用的buildpack中是否有任何一点,并确保与Rails应用程序的数据库的连接是否有效?*加载环境是这项任务的要求,我不知道如何解决它,它给出了典型的错误:
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
当然,我可以在本地编译然后部署.但buildpack似乎是以自动方式解决此问题的正确工具.谢谢您的帮助!
arrays ×1
buildpack ×1
fish ×1
heroku ×1
include ×1
modularity ×1
ocaml ×1
ocamlbuild ×1
raml ×1
reason ×1
shell ×1
types ×1
typescript ×1