Welcome to the GHC User’s Guide¶
Contents:
- 1. The Glasgow Haskell Compiler License
- 2. Introduction to GHC
- 3. Release notes for version 8.4.2
- 4. Release notes for version 8.6.1
- 5. Using GHCi
- 5.1. Introduction to GHCi
- 5.2. Loading source files
- 5.3. Loading compiled code
- 5.4. Interactive evaluation at the prompt
- 5.4.1. I/O actions at the prompt
- 5.4.2. Using
do
notation at the prompt - 5.4.3. Multiline input
- 5.4.4. Type, class and other declarations
- 5.4.5. What’s really in scope at the prompt?
- 5.4.6. The
:main
and:run
commands - 5.4.7. The
it
variable - 5.4.8. Type defaulting in GHCi
- 5.4.9. Using a custom interactive printing function
- 5.4.10. Stack Traces in GHCi
- 5.5. The GHCi Debugger
- 5.6. Invoking GHCi
- 5.7. GHCi commands
- 5.8. The
:set
and:seti
commands - 5.9. The
.ghci
and.haskeline
files - 5.10. Compiling to object code inside GHCi
- 5.11. Running the interpreter in a separate process
- 5.12. FAQ and Things To Watch Out For
- 6. Using runghc
- 7. Using GHC
- 7.1. Using GHC
- 7.2. Warnings and sanity-checking
- 7.3. Optimisation (code improvement)
- 7.4. Using Concurrent Haskell
- 7.5. Using SMP parallelism
- 7.6. Flag reference
- 7.6.1. Verbosity options
- 7.6.2. Alternative modes of operation
- 7.6.3. Which phases to run
- 7.6.4. Redirecting output
- 7.6.5. Keeping intermediate files
- 7.6.6. Temporary files
- 7.6.7. Finding imports
- 7.6.8. Interface file options
- 7.6.9. Recompilation checking
- 7.6.10. Interactive-mode options
- 7.6.11. Packages
- 7.6.12. Language options
- 7.6.13. Warnings
- 7.6.14. Optimisation levels
- 7.6.15. Individual optimisations
- 7.6.16. Profiling options
- 7.6.17. Program coverage options
- 7.6.18. C pre-processor options
- 7.6.19. Code generation options
- 7.6.20. Linking options
- 7.6.21. Plugin options
- 7.6.22. Replacing phases
- 7.6.23. Forcing options to particular phases
- 7.6.24. Platform-specific options
- 7.6.25. Compiler debugging options
- 7.6.26. Miscellaneous compiler options
- 7.7. Running a compiled program
- 7.7.1. Setting RTS options
- 7.7.2. Miscellaneous RTS options
- 7.7.3. RTS options to control the garbage collector
- 7.7.4. RTS options to produce runtime statistics
- 7.7.5. RTS options for concurrency and parallelism
- 7.7.6. RTS options for profiling
- 7.7.7. Tracing
- 7.7.8. RTS options for hackers, debuggers, and over-interested souls
- 7.7.9. Getting information about the RTS
- 7.8. Filenames and separate compilation
- 7.8.1. Haskell source files
- 7.8.2. Output files
- 7.8.3. The search path
- 7.8.4. Redirecting the compilation output(s)
- 7.8.5. Keeping Intermediate Files
- 7.8.6. Redirecting temporary files
- 7.8.7. Other options related to interface files
- 7.8.8. The recompilation checker
- 7.8.9. How to compile mutually recursive modules
- 7.8.10. Module signatures
- 7.8.11. Using
make
- 7.8.12. Dependency generation
- 7.8.13. Orphan modules and instance declarations
- 7.9. Packages
- 7.9.1. Using Packages
- 7.9.2. The
main
package - 7.9.3. Consequences of packages for the Haskell language
- 7.9.4. Thinning and renaming modules
- 7.9.5. Package Databases
- 7.9.6. Installed package IDs, dependencies, and broken packages
- 7.9.7. Package management (the
ghc-pkg
command) - 7.9.8. Building a package from Haskell source
- 7.9.9.
InstalledPackageInfo
: a package specification
- 7.10. GHC Backends
- 7.11. Options related to a particular phase
- 7.12. Using shared libraries
- 7.13. Debugging the compiler
- 8. Profiling
- 8.1. Cost centres and cost-centre stacks
- 8.2. Compiler options for profiling
- 8.3. Time and allocation profiling
- 8.4. Profiling memory usage
- 8.5.
hp2ps
– Rendering heap profiles to PostScript - 8.6. Profiling Parallel and Concurrent Programs
- 8.7. Observing Code Coverage
- 8.8. Using “ticky-ticky” profiling (for implementors)
- 9. Advice on: sooner, faster, smaller, thriftier
- 10. GHC Language Features
- 10.1. Language options
- 10.2. Unboxed types and primitive operations
- 10.3. Syntactic extensions
- 10.3.1. Unicode syntax
- 10.3.2. The magic hash
- 10.3.3. Negative literals
- 10.3.4. Fractional looking integer literals
- 10.3.5. Binary integer literals
- 10.3.6. Hexadecimal floating point literals
- 10.3.7. Numeric underscores
- 10.3.8. Pattern guards
- 10.3.9. View patterns
- 10.3.10. n+k patterns
- 10.3.11. The recursive do-notation
- 10.3.12. Applicative do-notation
- 10.3.13. Parallel List Comprehensions
- 10.3.14. Generalised (SQL-like) List Comprehensions
- 10.3.15. Monad comprehensions
- 10.3.16. New monadic failure desugaring mechanism
- 10.3.17. Rebindable syntax and the implicit Prelude import
- 10.3.18. Postfix operators
- 10.3.19. Tuple sections
- 10.3.20. Lambda-case
- 10.3.21. Empty case alternatives
- 10.3.22. Multi-way if-expressions
- 10.3.23. Local Fixity Declarations
- 10.3.24. Import and export extensions
- 10.3.25. More liberal syntax for function arguments
- 10.3.26. Summary of stolen syntax
- 10.4. Extensions to data types and type synonyms
- 10.4.1. Data types with no constructors
- 10.4.2. Data type contexts
- 10.4.3. Infix type constructors, classes, and type variables
- 10.4.4. Type operators
- 10.4.5. Liberalised type synonyms
- 10.4.6. Existentially quantified data constructors
- 10.4.7. Declaring data types with explicit constructor signatures
- 10.4.8. Generalised Algebraic Data Types (GADTs)
- 10.5. Extensions to the record system
- 10.6. Extensions to the “deriving” mechanism
- 10.6.1. Deriving instances for empty data types
- 10.6.2. Inferred context for deriving clauses
- 10.6.3. Stand-alone deriving declarations
- 10.6.4. Deriving instances of extra classes (
Data
, etc.) - 10.6.5. Generalised derived instances for newtypes
- 10.6.6. Deriving any other class
- 10.6.7. Deriving strategies
- 10.6.8. Deriving via
- 10.7. Pattern synonyms
- 10.8. Class and instances declarations
- 10.9. Type families
- 10.10. Datatype promotion
- 10.11. Kind polymorphism
- 10.11.1. Overview of kind polymorphism
- 10.11.2. Overview of Type-in-Type
- 10.11.3. Principles of kind inference
- 10.11.4. Complete user-supplied kind signatures and polymorphic recursion
- 10.11.5. Kind inference in closed type families
- 10.11.6. Kind inference in class instance declarations
- 10.11.7. Kind inference in type signatures
- 10.11.8. Explicit kind quantification
- 10.11.9. Kind-indexed GADTs
- 10.11.10. Higher-rank kinds
- 10.11.11. Constraints in kinds
- 10.11.12. The kind
Type
- 10.11.13. Inferring dependency in datatype declarations
- 10.11.14. Inferring dependency in user-written
forall
s - 10.11.15. Kind defaulting without
PolyKinds
- 10.11.16. Pretty-printing in the presence of kind polymorphism
- 10.12. Levity polymorphism
- 10.13. Type-Level Literals
- 10.14. Equality constraints, Coercible, and the kind Constraint
- 10.15. Quantified constraints
- 10.16. Extensions to type signatures
- 10.17. Lexically scoped type variables
- 10.18. Bindings and generalisation
- 10.19. Visible type application
- 10.20. Implicit parameters
- 10.21. Arbitrary-rank polymorphism
- 10.22. Impredicative polymorphism
- 10.23. Typed Holes
- 10.24. Partial Type Signatures
- 10.25. Custom compile-time errors
- 10.26. Deferring type errors to runtime
- 10.27. Template Haskell
- 10.28. Arrow notation
- 10.29. Bang patterns and Strict Haskell
- 10.30. Assertions
- 10.31. Static pointers
- 10.32. Pragmas
- 10.32.1.
LANGUAGE
pragma - 10.32.2.
OPTIONS_GHC
pragma - 10.32.3.
INCLUDE
pragma - 10.32.4.
WARNING
andDEPRECATED
pragmas - 10.32.5.
MINIMAL
pragma - 10.32.6.
INLINE
andNOINLINE
pragmas - 10.32.7.
LINE
pragma - 10.32.8.
COLUMN
pragma - 10.32.9.
RULES
pragma - 10.32.10.
SPECIALIZE
pragma - 10.32.11.
SPECIALIZE
instance pragma - 10.32.12.
UNPACK
pragma - 10.32.13.
NOUNPACK
pragma - 10.32.14.
SOURCE
pragma - 10.32.15.
COMPLETE
pragmas - 10.32.16. Disambiguating between multiple
COMPLETE
pragmas - 10.32.17.
OVERLAPPING
,OVERLAPPABLE
,OVERLAPS
, andINCOHERENT
pragmas
- 10.32.1.
- 10.33. Rewrite rules
- 10.34. Special built-in functions
- 10.35. Generic classes
- 10.36. Generic programming
- 10.37. Roles
- 10.38. HasCallStack
- 10.39. Concurrent and Parallel Haskell
- 10.40. Safe Haskell
- 11. Foreign function interface (FFI)
- 11.1. GHC differences to the FFI Chapter
- 11.2. GHC extensions to the FFI Chapter
- 11.3. Using the FFI with GHC
- 12. Extending and using GHC as a Library
- 13. What to do when something goes wrong
- 14. Debugging compiled programs
- 15. Other Haskell utility programs
- 16. Running GHC on Win32 systems
- 17. Known bugs and infelicities
- 17.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 17.1.1. Divergence from Haskell 98 and Haskell 2010
- 17.1.1.1. Lexical syntax
- 17.1.1.2. Context-free syntax
- 17.1.1.3. Expressions and patterns
- 17.1.1.4. Declarations and bindings
- 17.1.1.5. Typechecking of recursive binding groups
- 17.1.1.6. Module system and interface files
- 17.1.1.7. Numbers, basic types, and built-in classes
- 17.1.1.8. In
Prelude
support - 17.1.1.9. The Foreign Function Interface
- 17.1.1.10. Operator sections
- 17.1.2. GHC’s interpretation of undefined behaviour in Haskell 98 and Haskell 2010
- 17.1.1. Divergence from Haskell 98 and Haskell 2010
- 17.2. Known bugs or infelicities
- 17.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 18. Eventlog encodings
- 19. Care and feeding of your GHC User’s Guide