我是Haskell的新手,了解如何运行简短的脚本。但是,我正在尝试运行以下程序:https://github.com/bollu/cellularAutomata。该程序有一个包含Main.hs的app文件夹,一个源文件夹和一些shell脚本。
如何从终端运行此程序?
当前启动GHCi,正在加载Main.hs,但无法运行它。
这是我从应用程序直接加载Main时遇到的错误。
Prelude> :cd /Users/name/Downloads/code library/cellularAutomata-master/app
Prelude> :load Main
[1 of 8] Compiling Cyclic1D ( Cyclic1D.hs, interpreted )
Cyclic1D.hs:7:1: error:
Could not find module ‘Cellular’
Use -v to see a list of the files searched for.
|
7 | import Cellular
| ^^^^^^^^^^^^^^^
总共找不到6个模块。
-编辑-
在安装了cabal和stack并运行之后
stack build
在构建中途我收到此错误:
setup: The program 'pkg-config' version >=0.9.0 is required but it could not be found.
想法?最初我以为cairo附带有pkg-config,所以我花了一些时间建立符号链接,但是现在我相信pkg-config可能应该与堆栈或原始项目一起提供。
在尝试为cairo-0.13.3.1
和glib-0.13.4.1
编译StackSetupShim时浏览此错误显示的错误日志,下面是后者的示例:
/private/var/folders/1l/0993c3212tg_93l0d4ypfk1m0000gn/T/stack-215ef039e4c6f639/glib-0.13.4.1/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/setup [...] --dependency=utf8-string=utf8-string-1.0.1.1-1DpjxLeTvGg7ttZZojxJR5
Process exited with code: ExitFailure 1
Logs have been written to: /Users/name/stack/cellularAutomata/.stack-work/logs/glib-0.13.4.1.log
[1 of 2] Compiling Main ( /private/var/folders/1l/0993c3212tg_93l0d4ypfk1m0000gn/T/stack-215ef039e4c6f639/glib-0.13.4.1/Setup.hs, /private/var/folders/1l/0993c3212tg_93l0d4ypfk1m0000gn/T/stack-215ef039e4c6f639/glib-0.13.4.1/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim ( /Users/name/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/1l/0993c3212tg_93l0d4ypfk1m0000gn/T/stack-215ef039e4c6f639/glib-0.13.4.1/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/StackSetupShim.o )
Linking /private/var/folders/1l/0993c3212tg_93l0d4ypfk1m0000gn/T/stack-215ef039e4c6f639/glib-0.13.4.1/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/setup ...
Configuring glib-0.13.4.1...
setup: The program 'pkg-config' version >=0.9.0 is required but it could not
be found.```
答案 0 :(得分:4)
该项目使用Haskell Stack来管理依赖项。如果您使用自制软件,则可以将其与brew install stack
一起安装,也可以按照Stack文档中的说明进行安装。
安装后,您可以运行Shell脚本,例如./build-and-ghci.sh
,它将使用Stack下载ghc,项目依赖项,然后启动ghci。