The repository shall provide stack templates that allow for a quick start with ForSyDe and support the Haskell language server protocol, if your editor supports it. It works almost out of the box with VSCode if the Haskell extension is installed; for other editors, some more effort is required. The setup in your editor may take some time, and you may also need to restart the editor after completing the guide.
The guide assumes that you already have a Haskell environment installed. Otherwise, follow the instructions on the Haskell webpage to install it.
The stack template new-shallow gives a starting point for ForSyDe-Shallow models. The following text assumes that you create a new ForSyDe-Shallow project with the name my-shallow-project.
Create the project structure using the stack template forsyde/new-shallow.
stack new my-shallow-project forsyde/new-shallow
After creating the project structure, a few additional steps have to be taken to have a fully working ForSyDe-Shallow project.
Enter the project directory my-shallow-project and change the following in the files package.yaml and stack.yaml.
In package.yaml:
- Remove the comment character (
#) before- forsyde-shallow >= 3.5.0.0
In stack.yaml:
- Define the Haskell package set (see Stackage Server) that you want to use by adding a defined snapshot. We recommend using GHC 9.6.7 (LTS 22.44), as it is currently the latest supported version of GHC by the Haskell language server. So, modify the snapshot (usually given as 'url') to
snapshot: lts-22.44
- Add the extra dependency to ForSyDe-Shallow
extra-deps:
- forsyde-shallow-3.5.0.0
You can add it at the end of the file.
- If you encounter problems with the Haskell Language Server, add the line
system-ghc: true
- Enter the project directory and build the project
stack install
stack build
- Execute the project
stack exec my-shallow-project-exe
Now, you should receive the following output:
{2,3,4,5,6,7,8,9,10,11}
The stack template new-atom gives a starting point for ForSyDe-Atom models. The following text assumes that you create a new ForSyDe-Atom project with the name my-atom-project.
Create the project structure using the stack template forsyde/new-atom.
stack new my-atom-project forsyde/new-atom
After creating the project structure, a few additional steps have to be taken to have a fully working ForSyDe-Shallow project.
Enter the project directory my-atom-project and change the following in the files package.yaml and stack.yaml.
In package.yaml:
- Remove the comment character (
#) before- forsyde-atom >=0.3.2 && <0.3.3
In stack.yaml:
- Define the Haskell package set (see Stackage Server) that you want to use by adding a defined snapshot. We recommend using GHC 9.6.7 (LTS 22.44), as it is currently the latest supported GHC version by the Haskell language server. So, modify the snapshot (usually given as 'url') to
snapshot: lts-22.44
- Add the extra dependency to ForSyDe-Atom. Here we use an unofficial version that has been developed for the newer GHC version (9.6.7). You can add it at the end of the file.
extra-deps:
- git: git@github.com:forsyde/forsyde-atom.git
commit: faefc2d64c786c1a64aa0956eddb6853632e3ba5
- If you encounter problems with the Haskell Language Server, add the line
system-ghc: true
- Enter the project directory and build the project
stack install
stack build
- Execute the project
stack exec my-atom-project-exe
Now, you should receive the following output:
{2,3,4,5,6,7,8,9,10,11}