Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn that scripts cannot be package executables #10326

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions doc/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ the following file named ``myscript``:
main :: IO ()
main = haskellSay "Hello, Haskell!"

The necessary sections of a ``.cabal`` file are placed
directly into the script as a comment.
The necessary sections of a package description that would otherwise be in a
``.cabal`` file are placed directly into the script as a comment.

Use the familiar ``cabal run`` command to execute this script:

Expand All @@ -222,10 +222,18 @@ can be run directly after setting the execute permission (+x):

See more in the documentation for :ref:`cabal run`.

.. warning::

Single-file scripts cannot also be part of a package, as an executable or
listed as a module. Trying to run a module that is included in a package
will error with `Cabal-7070`_.

What Next?
----------

Now that you know how to set up a simple Haskell package using Cabal, check out
some of the resources on the Haskell website's `documentation page
<https://www.haskell.org/documentation/>`__ or read more about packages and
Cabal on the :doc:`What Cabal does <cabal-context>` page.

.. _Cabal-7070: https://errors.haskell.org/messages/Cabal-7070/
Loading