Conversation
Signed-off-by: Roosembert Palacios <roosemberth@posteo.ch>
|
@sol Gentle ping ^^ |
| The following `package.yaml` describes a project with a library under `src`, an executable under `app/Main.hs` and tests under `test/Main.hs`: | ||
|
|
||
| ```yaml | ||
| name: mylib |
There was a problem hiding this comment.
Perhaps my-package would be a better dummy name, as this will produce a Cabal file for a package with more than a library component.
|
|
||
| The following `package.yaml` describes a project with a library under `src`, an executable under `app/Main.hs` and tests under `test/Main.hs`: | ||
|
|
||
| ```yaml |
There was a problem hiding this comment.
I would include spec-version: 0.36.0, to ensure modern behaviour.
| name: mylib | ||
|
|
||
| dependencies: | ||
| - base >= 4.9 && < 5 |
There was a problem hiding this comment.
What is the basis for these bounds? The generated Cabal file will specify cabal-version: 1.12 which might imply base >= 4.4 (GHC 7.2.1 came with Cabal-1.12.0).
| library: | ||
| source-dirs: src | ||
|
|
||
| executable: |
There was a problem hiding this comment.
While executable: { ... } is strictly minimal, perhaps executables: { my-exe: { ... } } would be more useful?
| - mylib | ||
|
|
||
| tests: | ||
| spec: |
There was a problem hiding this comment.
Perhaps my-test-suite or my-package-test (given what cabal init would suggest) would be a better dummy name than spec?
| main: Main.hs | ||
| source-dirs: | ||
| - test | ||
| - src |
There was a problem hiding this comment.
For a minimal example, why include src as a source directory for the source code of a test suite application (also given what cabal init would suggest)?
| - test | ||
| - src | ||
| dependencies: | ||
| - QuickCheck |
There was a problem hiding this comment.
For a minimal example, I would expect a dependency on the package itself but not QuickCheck.
|
|
||
| ## Examples | ||
|
|
||
| The following `package.yaml` describes a project with a library under `src`, an executable under `app/Main.hs` and tests under `test/Main.hs`: |
There was a problem hiding this comment.
I think, strictly, (if you follow my other suggestions below):
... a package with a main library with source code under directory `src`, an
executable named `my-exe` with source code under `app`, and a test suite named
`my-test-suite` with source code under `test`:| @@ -32,6 +32,35 @@ at the Singapore Haskell meetup: http://typeful.net/talks/hpack | |||
|
|
|||
| ## Examples | |||
|
|
|||
There was a problem hiding this comment.
It may be worth acknowledging in the introduction that users of Stack have access to templates for projects that include package.yaml files, but users of Cabal (the tool) may find the minimal example useful.
Motivation for this MR
Every time I start working in a new Haskell project, I find myself in this
repository's README, copy one of the provided examples, but spend most of the
time removing keys I don't need. I think a simple example one can simply
'copy over' is both useful to making the tool accessible to beginners and
a practical base for experienced developers to build on.
Changes in this MR
This MR adds a short and simple example, matching the default
cabal init'Library and Executable' generation (
appandtestdirectories withMain.hsinside them and library insidesrc).