Added the quickstart section in the README.md
This commit is contained in:
parent
aefaca9076
commit
f351fc28c7
2 changed files with 65 additions and 65 deletions
65
README.md
65
README.md
|
@ -37,6 +37,71 @@ constraint to work around a
|
|||
[Cabal issue](https://github.com/haskell/cabal/issues/2759): `cabal install
|
||||
--constraint 'mono-traversable >= 0.9' stack`.
|
||||
|
||||
#### Quick Start Guide
|
||||
|
||||
First you need to [install it (see previous section)](#how-to-install).
|
||||
|
||||
##### Start your new project:
|
||||
|
||||
~~~ {.bash}
|
||||
stack new my-project
|
||||
cd my-project
|
||||
stack setup
|
||||
stack build
|
||||
stack exec my-project-exe
|
||||
~~~
|
||||
|
||||
- The `stack new` command will create a new directory containing all
|
||||
the needed files to start a project correctly.
|
||||
- The `stack setup` will download the compiler if necessary.
|
||||
- The `stack build` command will build the minimal project.
|
||||
- `stack exec my-project-exe` will execute the command.
|
||||
|
||||
If you want to launch a REPL:
|
||||
|
||||
~~~ {.bash}
|
||||
stack ghci
|
||||
~~~
|
||||
|
||||
##### Workflow
|
||||
|
||||
The `stack new` command should have created the following files:
|
||||
|
||||
~~~
|
||||
.
|
||||
├── LICENSE
|
||||
├── Setup.hs
|
||||
├── app
|
||||
│ └── Main.hs
|
||||
├── my-project.cabal
|
||||
├── src
|
||||
│ └── Lib.hs
|
||||
├── stack.yaml
|
||||
└── test
|
||||
└── Spec.hs
|
||||
|
||||
3 directories, 7 files
|
||||
~~~
|
||||
|
||||
So to manage your library:
|
||||
|
||||
1. Edit files in the `src/` directory.
|
||||
|
||||
The `app` directory should preferably contains only files related to
|
||||
executables.
|
||||
|
||||
2. If you need to include another library (for example the package [`text`](https://hackage.haskell.org/package/text):
|
||||
|
||||
- Add the package `text` to the file `my-project.cabal`
|
||||
in the section `build-depends: ...`.
|
||||
- run `stack build` another time
|
||||
|
||||
3. If you get an error that tells you your package isn't in the LTS.
|
||||
Just try to add a new version in the `stack.yaml` file in the `extra-deps` section.
|
||||
|
||||
It was a really fast introduction on how to start to code in Haskell using `stack`.
|
||||
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).
|
||||
|
||||
#### How to use
|
||||
|
||||
Go into a Haskell project directory and run `stack build`. If everything is
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
# `stack` Quick Start Guide
|
||||
|
||||
If not already done you first need to
|
||||
[install `stack`](https://github.com/commercialhaskell/stack/blob/master/doc/install_and_upgrade.md).
|
||||
|
||||
## Start your new project:
|
||||
|
||||
~~~ {.bash}
|
||||
stack new my-project
|
||||
cd my-project
|
||||
stack setup
|
||||
stack build
|
||||
stack exec my-project-exe
|
||||
~~~
|
||||
|
||||
- The `stack new` command will create a new directory containing all
|
||||
the needed files to start a project correctly.
|
||||
- The `stack setup` will download the compiler if necessary.
|
||||
- The `stack build` command will build the minimal project.
|
||||
- `stack exec my-project-exe` will execute the command.
|
||||
|
||||
If you want to launch a REPL:
|
||||
|
||||
~~~ {.bash}
|
||||
stack ghci
|
||||
~~~
|
||||
|
||||
## Workflow
|
||||
|
||||
The `stack new` command should have created the following files:
|
||||
|
||||
~~~
|
||||
.
|
||||
├── LICENSE
|
||||
├── Setup.hs
|
||||
├── app
|
||||
│ └── Main.hs
|
||||
├── my-project.cabal
|
||||
├── src
|
||||
│ └── Lib.hs
|
||||
├── stack.yaml
|
||||
└── test
|
||||
└── Spec.hs
|
||||
|
||||
3 directories, 7 files
|
||||
~~~
|
||||
|
||||
So to manage your library:
|
||||
|
||||
1. Edit files in the `src/` directory.
|
||||
|
||||
The `app` directory should preferably contains only files related to
|
||||
executables.
|
||||
|
||||
2. If you need to include another library (for example the package [`text`](https://hackage.haskell.org/package/text):
|
||||
|
||||
- Add the package `text` to the file `my-project.cabal`
|
||||
in the section `build-depends: ...`.
|
||||
- run `stack build` another time
|
||||
|
||||
3. If you get an error that tells you your package isn't in the LTS.
|
||||
Just try to add a new version in the `stack.yaml` file in the `extra-deps` section.
|
||||
|
||||
It was a really fast introduction on how to start to code in Haskell using `stack`.
|
||||
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).
|
Loading…
Reference in a new issue