@@ -37,6 +37,71 @@ constraint to work around a
3737[ Cabal issue] ( https://github.com/haskell/cabal/issues/2759 ) : `cabal install
3838--constraint 'mono-traversable >= 0.9' stack`.
3939
40+ #### Quick Start Guide
41+
42+ First you need to [ install it (see previous section)] ( #how-to-install ) .
43+
44+ ##### Start your new project:
45+
46+ ~~~ {.bash}
47+ stack new my-project
48+ cd my-project
49+ stack setup
50+ stack build
51+ stack exec my-project-exe
52+ ~~~
53+
54+ - The ` stack new ` command will create a new directory containing all
55+ the needed files to start a project correctly.
56+ - The ` stack setup ` will download the compiler if necessary.
57+ - The ` stack build ` command will build the minimal project.
58+ - ` stack exec my-project-exe ` will execute the command.
59+
60+ If you want to launch a REPL:
61+
62+ ~~~ {.bash}
63+ stack ghci
64+ ~~~
65+
66+ ##### Workflow
67+
68+ The ` stack new ` command should have created the following files:
69+
70+ ~~~
71+ .
72+ ├── LICENSE
73+ ├── Setup.hs
74+ ├── app
75+ │ └── Main.hs
76+ ├── my-project.cabal
77+ ├── src
78+ │ └── Lib.hs
79+ ├── stack.yaml
80+ └── test
81+ └── Spec.hs
82+
83+ 3 directories, 7 files
84+ ~~~
85+
86+ So to manage your library:
87+
88+ 1 . Edit files in the ` src/ ` directory.
89+
90+ The ` app ` directory should preferably contains only files related to
91+ executables.
92+
93+ 2 . If you need to include another library (for example the package [ ` text ` ] ( https://hackage.haskell.org/package/text ) :
94+
95+ - Add the package ` text ` to the file ` my-project.cabal `
96+ in the section ` build-depends: ... ` .
97+ - run ` stack build ` another time
98+
99+ 3 . If you get an error that tells you your package isn't in the LTS.
100+ Just try to add a new version in the ` stack.yaml ` file in the ` extra-deps ` section.
101+
102+ It was a really fast introduction on how to start to code in Haskell using ` stack ` .
103+ If you want to go further, we highly recommend you to read the [ ` stack ` guide] ( https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md ) .
104+
40105#### How to use
41106
42107Go into a Haskell project directory and run ` stack build ` . If everything is
0 commit comments