Skip to content

Commit 3561064

Browse files
committed
Document contents of helloworld package description files
1 parent ea4e900 commit 3561064

File tree

1 file changed

+211
-0
lines changed

1 file changed

+211
-0
lines changed

doc/tutorial/hello_world_example.md

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,222 @@ functionality to create a Cabal file.
431431
The [Hpack](https://github.com/sol/hpack#quick-reference) documentation
432432
is the reference for the Hpack package description format.
433433

434+
??? question "What are the contents of the `package.yaml` file?"
435+
436+
The contents of the `package.yaml` file are described below, using
437+
additional YAML comments:
438+
439+
~~~yaml
440+
# The name of the package:
441+
name: helloworld
442+
# The version of the package:
443+
version: 0.1.0.0
444+
# The GitHub repository for the package:
445+
github: "githubuser/helloworld"
446+
# The licence for the use of the package's files:
447+
license: BSD-3-Clause
448+
# The author of the package:
449+
author: "Author name here"
450+
# The email address to contact the maintainer of the package:
451+
maintainer: "[email protected]"
452+
# The copyright for the package's files:
453+
copyright: "2024 Author name here"
454+
455+
# Extra files to be distributed with the source files of the package:
456+
extra-source-files:
457+
- README.md
458+
- CHANGELOG.md
459+
460+
# Metadata used when publishing your package
461+
# synopsis: Short description of your package
462+
# category: Web
463+
464+
# To avoid duplicated efforts in documentation and dealing with the
465+
# complications of embedding Haddock markup inside cabal files, it is
466+
# common to point users to the README.md file.
467+
description: Please see the README on GitHub at
468+
<https://github.com/githubuser/helloworld#readme>
469+
470+
# Dependencies applicable to all components:
471+
dependencies:
472+
- base >= 4.7 && < 5
473+
474+
# GHC options common to all components:
475+
ghc-options:
476+
# These GHC flags affect which warnings GHC will emit:
477+
- -Wall
478+
- -Wcompat
479+
- -Widentities
480+
- -Wincomplete-record-updates
481+
- -Wincomplete-uni-patterns
482+
- -Wmissing-export-lists
483+
- -Wmissing-home-modules
484+
- -Wpartial-fields
485+
- -Wredundant-constraints
486+
487+
# The main (unnamed) library component of the package:
488+
library:
489+
# Directories containing source files:
490+
source-dirs: src
491+
492+
# The executable components of the package:
493+
executables:
494+
# The executable component named 'helloworld-exe':
495+
helloworld-exe:
496+
# The source file exporting the 'main' function:
497+
main: Main.hs
498+
# Directories containing source files:
499+
source-dirs: app
500+
# GHC options applicable to the component:
501+
ghc-options:
502+
# Link the program with the 'threaded' version of GHC's runtime system:
503+
- -threaded
504+
# Make all of GHC's runtime system (RTS) options available:
505+
- -rtsopts
506+
# Compile so as to use simultaneous threads when running the program,
507+
# based on how many processors are in the machine.
508+
- -with-rtsopts=-N
509+
# Dependencies applicable to the component:
510+
dependencies:
511+
# The main library of the package:
512+
- helloworld
513+
514+
# The test suite components of the package. Test suites have keys in common
515+
# with executables:
516+
tests:
517+
# The test suite component named 'helloworld-test':
518+
helloworld-test:
519+
main: Spec.hs
520+
source-dirs: test
521+
ghc-options:
522+
- -threaded
523+
- -rtsopts
524+
- -with-rtsopts=-N
525+
dependencies:
526+
- helloworld
527+
~~~
528+
434529
### `helloworld.cabal`
435530

436531
The `helloworld.cabal` file is updated automatically as part of the
437532
`stack build` process and should not be modified.
438533

534+
??? question "What are the contents of the `helloworld.cabal` file?"
535+
536+
The contents of the `helloworld.cabal` file are described below, using
537+
additional Cabal file comments:
538+
539+
~~~text
540+
-- The version of the Cabal package description format specification:
541+
cabal-version: 2.2
542+
543+
-- This file has been generated from package.yaml by hpack version 0.37.0.
544+
--
545+
-- see: https://github.com/sol/hpack
546+
547+
-- The name of the package:
548+
name: helloworld
549+
-- The version of the package:
550+
version: 0.1.0.0
551+
-- The description of the package:
552+
description: Please see the README on GitHub at
553+
<https://github.com/githubuser/helloworld#readme>
554+
-- A URL for the package:
555+
homepage: https://github.com/githubuser/helloworld#readme
556+
-- A URL for bug reports for the package:
557+
bug-reports: https://github.com/githubuser/helloworld/issues
558+
-- The author of the package:
559+
author: Author name here
560+
-- The email address to contact the maintainer of the package:
561+
maintainer: [email protected]
562+
-- The copyright for the package's files:
563+
copyright: 2024 Author name here
564+
-- The licence for the use of the package's files:
565+
license: BSD-3-Clause
566+
-- The file documenting the terms of the licence:
567+
license-file: LICENSE
568+
-- The Cabal system build type of the package:
569+
build-type: Simple
570+
-- Extra files to be distributed with the source files of the package:
571+
extra-source-files:
572+
README.md
573+
CHANGELOG.md
574+
575+
-- The respository for the package:
576+
source-repository head
577+
type: git
578+
location: https://github.com/githubuser/helloworld
579+
580+
-- The main (unnamed) library component of the package:
581+
library
582+
-- The modules that the library exposes:
583+
exposed-modules:
584+
Lib
585+
-- The other modules of the compoment:
586+
other-modules:
587+
Paths_helloworld
588+
-- Automatically generated modules of the component:
589+
autogen-modules:
590+
Paths_helloworld
591+
-- Directories containing source files:
592+
hs-source-dirs:
593+
src
594+
-- GHC options applicable to the component. In this case, they are flags
595+
-- that affect which warnings GHC will emit:
596+
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates
597+
-Wincomplete-uni-patterns -Wmissing-export-lists
598+
-Wmissing-home-modules -Wpartial-fields
599+
-Wredundant-constraints
600+
-- Dependencies applicable to the building of the component:
601+
build-depends:
602+
base >=4.7 && <5
603+
-- The applicable version of the Haskell language:
604+
default-language: Haskell2010
605+
606+
-- The executable 'helloworld-exe' component of the package. Executable
607+
-- components have fields in common with library components:
608+
executable helloworld-exe
609+
-- The source file exporting the 'main' function:
610+
main-is: Main.hs
611+
other-modules:
612+
Paths_helloworld
613+
autogen-modules:
614+
Paths_helloworld
615+
hs-source-dirs:
616+
app
617+
-- GHC options applicable to the component. In this case, they include
618+
-- flags that affect GHC's runtime system (RTS).
619+
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates
620+
-Wincomplete-uni-patterns -Wmissing-export-lists
621+
-Wmissing-home-modules -Wpartial-fields
622+
-Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
623+
build-depends:
624+
base >=4.7 && <5
625+
, helloworld
626+
default-language: Haskell2010
627+
628+
-- The test suite 'helloworld-test' component of the package. Test suite
629+
-- components have fields in common with executable components:
630+
test-suite helloworld-test
631+
-- The type of the test suite:
632+
type: exitcode-stdio-1.0
633+
main-is: Spec.hs
634+
other-modules:
635+
Paths_helloworld
636+
autogen-modules:
637+
Paths_helloworld
638+
hs-source-dirs:
639+
test
640+
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates
641+
-Wincomplete-uni-patterns -Wmissing-export-lists
642+
-Wmissing-home-modules -Wpartial-fields
643+
-Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
644+
build-depends:
645+
base >=4.7 && <5
646+
, helloworld
647+
default-language: Haskell2010
648+
~~~
649+
439650
### `Setup.hs`
440651

441652
The `Setup.hs` file is a component of the Cabal build system.

0 commit comments

Comments
 (0)