Skip to content

Commit

Permalink
Add warning and note about cabal init and script
Browse files Browse the repository at this point in the history
Fixes #10325
  • Loading branch information
philderbeast committed Sep 6, 2024
1 parent 3a6f73e commit b7a0613
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion doc/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ The ``myapp.cabal`` file is a package description file, commonly referred to as
hs-source-dirs: app
default-language: Haskell2010
.. warning::

The version bounds on base, a boot library distributed with GHC, are tied to
the GHC version visible when ``cabal init`` is run. If run with a later
version of GHC you might see a difference in the version bounds.

.. code-block:: diff
- build-depends: base ^>=4.19.0.0
+ build-depends: base ^>=4.20.0.0
It contains metadata (package name and version, author name, license, etc.) and sections
to define package components. Components can be used to split large codebases into smaller,
more managable building blocks.
Expand Down Expand Up @@ -189,7 +200,7 @@ the following file named ``myscript``:
#!/usr/bin/env cabal
{- cabal:
build-depends:
base ^>=4.19.0.0,
base,
haskell-say ^>=1.0.0.0
-}
Expand All @@ -198,6 +209,19 @@ the following file named ``myscript``:
main :: IO ()
main = haskellSay "Hello, Haskell!"
.. note::

Version bounds are recommended but widening or dropping version bound
constraints on some packages, especially boot packages like base, for
single-file scripts will allow the script to run with a wider range of GHC
versions.

.. code-block:: diff
build-depends:
- base ^>=4.19.0.0,
+ base,
The necessary sections of a ``.cabal`` file are placed
directly into the script as a comment.

Expand Down

0 comments on commit b7a0613

Please sign in to comment.