tldr/pages/common/ghc.md

30 lines
488 B
Markdown
Raw Permalink 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 {{file.hs}}`
2016-05-05 17:33:43 +01:00
- Compile using extra optimization:
2016-05-05 02:22:26 +01:00
`ghc -O {{file.hs}}`
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 {{file.hs}}`
- Start a REPL (interactive shell):
2016-05-05 02:22:26 +01:00
`ghci`
- Evaluate a single expression:
`ghc -e {{expression}}`