Tutorial by Examples

Mac OSX Using Homebrew: brew install haskell-stack
To create a project called helloworld run: stack new helloworld simple This will create a directory called helloworld with the files necessary for a Stack project.
File structure A simple project has the following files included in it: ➜ helloworld ls LICENSE Setup.hs helloworld.cabal src stack.yaml In the folder src there is a file named Main.hs. This is the "starting point" of the helloworld project. By default...
Stackage is a repository for Haskell packages. We can add these packages to a stack project. Adding lens to a project. In a stack project, there is a file called stack.yaml. In stack.yaml there is a segment that looks like: resolver: lts-6.8 Stackage keeps a list of packages for every revision...
In this example our project name is "helloworld" which was created with stack new helloworld simple First we have to build the project with stack build and then we can run it with stack exec helloworld-exe
By running the command stack install Stack will copy a executable file to the folder /Users/<yourusername>/.local/bin/
Configure profiling for a project via stack. First build the project with the --profile flag: stack build --profile GHC flags are not required in the cabal file for this to work (like -prof). stack will automatically turn on profiling for both the library and executables in the project. The next...
To find out what packages your project directly depends on, you can simply use this command: stack list-dependencies This way you can find out what version of your dependencies where actually pulled down by stack. Haskell projects frequently find themselves pulling in a lot of libraries indirec...

Page 1 of 1