Reputation: 51
I'm new to Haskell and understand how to run a short script. However, I'm trying to run this program: https://github.com/bollu/cellularAutomata. This program has an app folder with Main.hs, a source folder, and some shell scripts.
How do you run this from terminal?
Currently firing up GHCi, loading Main.hs and not being able to run it.
This is the error I get right now when I load Main straight from the app.
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
| ^^^^^^^^^^^^^^^
In total, it can't find 6 modules.
--EDIT--
After installing cabal and stack and running
stack build
I receive this error halfway through the build:
setup: The program 'pkg-config' version >=0.9.0 is required but it could not be found.
Ideas? Originally I thought pkg-config came with cairo, so I spent time putting symlinks to that, but now I believe perhaps pkg-config should come with either stack or the original project.
Looking through the error logs this error shows while trying to compile StackSetupShim for both cairo-0.13.3.1
and glib-0.13.4.1
, sample one for the latter below:
/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.```
Upvotes: 2
Views: 281
Reputation: 1629
This project uses Haskell Stack for managing dependencies. It can be installed with brew install stack
if you're using homebrew, or by following the instructions in the Stack documentation.
Once installed, you can run the shell scripts, eg ./build-and-ghci.sh
, which will use Stack to download ghc, the project dependencies, and then start ghci.
Upvotes: 4