Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell cabal在构建期间编译.js_Haskell_Cabal_Fay_Haste - Fatal编程技术网

Haskell cabal在构建期间编译.js

Haskell cabal在构建期间编译.js,haskell,cabal,fay,haste,Haskell,Cabal,Fay,Haste,假设我正在构建一个web应用程序,其中haskell同时作为服务器端和客户端代码。在构建阶段,我想用ghc编译服务器端代码,用haskell-to-js transpiler编译客户端代码 haskell transpiler工具公开了一个可执行文件,我需要用.hs文件提供它,它将编译成.js文件。如何在cabal中指定在构建阶段运行外部程序?我可以看到,UserHooks字段buildHook具有返回类型IO(),因此理论上我可以使用例如shelly库来执行shell代码来运行transpil

假设我正在构建一个web应用程序,其中haskell同时作为服务器端和客户端代码。在构建阶段,我想用
ghc
编译服务器端代码,用haskell-to-js transpiler编译客户端代码

haskell transpiler工具公开了一个可执行文件,我需要用
.hs
文件提供它,它将编译成
.js
文件。如何在cabal中指定在构建阶段运行外部程序?我可以看到,
UserHooks
字段
buildHook
具有返回类型
IO()
,因此理论上我可以使用例如shelly库来执行shell代码来运行transpiler,但我不知道这是否是最干净的解决方案。

我写过关于解决相同问题的文章

使用自定义安装文件通常不是一个好主意,因为没有办法处理它的依赖项,除非您先安装这些依赖项,否则您甚至不能
sdist

我发现有一个可选的命令行选项可以在Web服务器启动时预编译代码

另一种选择是拥有一个编译这两者的makefile