ghc
Compiler for the Haskell functional programming language
TLDR
SYNOPSIS
ghc [options] files
DESCRIPTION
ghc (Glasgow Haskell Compiler) is the leading compiler for the Haskell programming language. It compiles Haskell source code to native machine code, producing efficient executables.GHC supports the full Haskell language standard plus numerous extensions for advanced type system features, parallelism, and performance. The --make mode (default) automatically handles module dependencies. GHC also provides native code generation and an optional LLVM backend.
PARAMETERS
FILES
Haskell source files (.hs, .lhs).-o FILE
Output file name.-c
Compile to object file only.-O, -O1
Enable standard optimization.-O2
Enable aggressive optimization with additional passes.-O0
Disable optimization (default).-Wall
Enable most warnings.-w
Suppress all warnings.-Werror
Treat warnings as errors.-iDIR
Add directory to import search path.-package PKG
Expose the specified package.--make
Build program and resolve module dependencies automatically.-e EXPR
Evaluate a single expression and exit.-j[N]
Compile N modules in parallel.-threaded
Use the threaded runtime system.-prof
Enable profiling.-fllvm
Compile via LLVM backend.-XEXTENSION
Enable a language extension (e.g., -XOverloadedStrings).-cpp
Run the C preprocessor on source files.-v[N]
Set verbosity level (0-3).--help
Display help information.
CAVEATS
Compilation can be memory-intensive. Large projects benefit from incremental builds. Extension flags vary by GHC version. The -O2 level significantly increases compile time compared to -O.
HISTORY
GHC was started at the University of Glasgow in 1989. It has become the de facto standard Haskell compiler, actively developed by the Haskell community and industrial users.
