Skip to content

Commit 33666ec

Browse files
committed
Merge branch 'stable'
2 parents 956a82d + 5ed9519 commit 33666ec

File tree

11 files changed

+1130
-696
lines changed

11 files changed

+1130
-696
lines changed

doc/README.md

Lines changed: 139 additions & 184 deletions
Large diffs are not rendered by default.

doc/community/index.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Get involved
3+
---
4+
<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://cdn.jsdelivr.net/gh/commercialhaskell/stack/doc/img/hidden-warning.svg"></a></div>
5+
6+
# Get involved
7+
8+
## Feedback and discussion
9+
10+
* For general comments, feedback and support, please post to the
11+
[Haskell Community](https://discourse.haskell.org/about).
12+
* For bugs, issues, or requests, please
13+
[open an issue](https://github.com/commercialhaskell/stack/issues/new).
14+
* When using Stack Overflow, please use the
15+
[haskell-stack](http://stackoverflow.com/questions/tagged/haskell-stack) tag.
16+
17+
## How to contribute to the maintenance or development of Stack
18+
19+
A [guide](../CONTRIBUTING.md) is provided to help potential contributors to the
20+
Stack project.
21+
22+
If you have already installed a version of Stack and the
23+
[Git application](https://git-scm.com/) the followings steps should get you
24+
started with building Stack from source with Stack:
25+
26+
1. Clone the `stack` repository from GitHub with the command:
27+
28+
~~~text
29+
git clone https://github.com/commercialhaskell/stack.git
30+
~~~
31+
32+
2. Change the current working directory to the cloned `stack` directory with
33+
the command:
34+
35+
~~~text
36+
cd stack
37+
~~~
38+
39+
3. Build the `stack` executable using a preexisting installation of Stack with
40+
the command:
41+
42+
~~~text
43+
stack build
44+
~~~
45+
46+
4. Once the `stack` executable has been built, check its version with the
47+
command:
48+
49+
~~~text
50+
stack exec -- stack --version
51+
~~~
52+
53+
Make sure the version is the latest one.
54+
55+
5. In the GitHub repository's issue tracker, look for issues tagged with
56+
[newcomer friendly](https://github.com/commercialhaskell/stack/issues?q=is%3Aopen+is%3Aissue+label%3a%22newcomer+friendly%22)
57+
and
58+
[awaiting pull request](https://github.com/commercialhaskell/stack/issues?q=is%3Aopen+is%3Aissue+label%3A%22awaiting+pull+request%22)
59+
labels.
60+
61+
If you need to check your changes quickly command:
62+
63+
~~~text
64+
stack repl
65+
~~~
66+
67+
and then, at the REPL's prompt, command:
68+
69+
~~~text
70+
:main --stack-root=<path_to_root> --stack-yaml=<path_to_stack.yaml> <COMMAND>
71+
~~~
72+
73+
This allows you to set a special Stack root (instead of the default Stack root)
74+
and to target your commands at a particular `stack.yaml` file instead of the one
75+
found in the current directory.

doc/configure/yaml/project.md

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ currently four snapshot types:
4444
* No snapshot, just use packages shipped with the compiler. For GHC this looks
4545
like `snapshot: ghc-9.6.5`
4646
* Custom snapshot, via a URL or relative file path. For further information, see
47-
the [snapshot and package location](../../topics/pantry.md) documentation.
47+
the [snapshot location](../../topics/snapshot_location.md) documentation.
4848

4949
Each of these snapshots will also determine what constraints are placed on the
5050
compiler version. See the [compiler-check](non-project.md#compiler-check) option
@@ -122,7 +122,8 @@ A Pantry package location is one or three different kinds of sources:
122122
* a Git or Mercurial repository.
123123

124124
For further information on the format for specifying a Pantry package location,
125-
see the [Pantry](../../topics/pantry.md) documentation. For example:
125+
see the [package location](../../topics/package_location.md) documentation. For
126+
example:
126127

127128
~~~yaml
128129
extra-deps:
@@ -314,7 +315,95 @@ custom-preprocessor-extensions:
314315
- erb
315316
~~~
316317

317-
TODO: Add a simple example of how to use custom preprocessors.
318+
??? example "Use of a custom preprocessor"
319+
320+
The [Ruby](https://www.ruby-lang.org/en/) programming language provides
321+
[`erb`](https://docs.ruby-lang.org/en/master/ERB.html) at the command line.
322+
`erb` provides a templating system for Ruby. The following example uses
323+
`erb` as a custom preprocessor.
324+
325+
The example is a single-package project with a customised `Setup.hs`, which
326+
Stack will use to build:
327+
~~~haskell
328+
{-# LANGUAGE CPP #-}
329+
330+
module Main
331+
( main
332+
) where
333+
334+
import Distribution.Simple ( defaultMainWithHooks, simpleUserHooks )
335+
import Distribution.Simple.PreProcess
336+
( PreProcessor (..), mkSimplePreProcessor, unsorted )
337+
import Distribution.Simple.UserHooks ( UserHooks (..) )
338+
import Distribution.Types.BuildInfo ( BuildInfo )
339+
import Distribution.Types.ComponentLocalBuildInfo
340+
( ComponentLocalBuildInfo )
341+
import Distribution.Types.LocalBuildInfo ( LocalBuildInfo )
342+
import System.Process ( readCreateProcess, proc, shell )
343+
344+
main :: IO ()
345+
main = defaultMainWithHooks simpleUserHooks
346+
{ hookedPreProcessors = [("erb", runRuby)]
347+
}
348+
349+
runRuby ::
350+
BuildInfo
351+
-> LocalBuildInfo
352+
-> ComponentLocalBuildInfo
353+
-> PreProcessor
354+
runRuby _ _ _ = PreProcessor
355+
{ platformIndependent = True
356+
, ppOrdering = unsorted
357+
, runPreProcessor = mkSimplePreProcessor $ \erbFile fout verbosity ->
358+
readCreateProcess (erbProcess erbFile) "" >>= writeFile fout
359+
}
360+
where
361+
erbProcess erbFile =
362+
#if defined(mingw32_HOST_OS)
363+
shell $ "erb " <> erbFile
364+
#else
365+
proc "erb" [erbFile]
366+
#endif
367+
~~~
368+
369+
The example has a package description file (`package.yaml`) that specifies a
370+
`Custom` build type:
371+
~~~yaml
372+
spec-version: 0.36.0
373+
name: my-package
374+
version: 0.1.0.0
375+
build-type: Custom
376+
377+
dependencies: base
378+
379+
custom-setup:
380+
dependencies:
381+
- base
382+
- Cabal
383+
- process
384+
385+
library:
386+
source-dirs: src
387+
generated-exposed-modules: MyModule
388+
~~~
389+
390+
The example has a `src/MyModule.erb` file that will be preprocessed to
391+
create Haskell source code:
392+
~~~text
393+
module MyModule where
394+
395+
<% (1..5).each do |i| %>
396+
test<%= i %> :: Int
397+
test<%= i %> = <%= i %>
398+
<% end %>
399+
~~~
400+
401+
The example has a project-level configuration file (`stack.yaml`):
402+
~~~yaml
403+
snapshot: lts-22.30
404+
custom-preprocessor-extensions:
405+
- erb
406+
~~~
318407

319408
## extra-package-dbs
320409

0 commit comments

Comments
 (0)