tldr/pages/common/ghc.md

30 lines
512 B
Markdown
Raw Normal View History

2016-05-05 02:22:26 +01:00
# ghc
2016-05-05 17:33:43 +01:00
> The Glasgow Haskell Compiler.
> Compiles and links Haskell source files.
2019-06-07 11:58:23 +01:00
> More information: <https://www.haskell.org/ghc>.
2016-05-05 02:22:26 +01:00
- Find and compile all modules in the current directory:
`ghc Main`
- Compile a single file:
`ghc {{path/to/file.hs}}`
2016-05-05 02:22:26 +01:00
2016-05-05 17:33:43 +01:00
- Compile using extra optimization:
2016-05-05 02:22:26 +01:00
`ghc -O {{path/to/file.hs}}`
2016-05-05 02:22:26 +01:00
2016-05-05 17:33:43 +01:00
- Stop compilation after generating object files (.o):
2016-05-05 02:22:26 +01:00
`ghc -c {{path/to/file.hs}}`
2016-05-05 02:22:26 +01:00
- Start a REPL (interactive shell):
2016-05-05 02:22:26 +01:00
`ghci`
- Evaluate a single expression:
`ghc -e {{expression}}`