Welcome to the GHC User’s Guide¶
Contents:
- 1. The Glasgow Haskell Compiler License
- 2. Introduction to GHC
- 3. Release notes for version 8.6.1
- 4. Release notes for version 8.6.2
- 5. Release notes for version 8.6.3
- 6. Release notes for version 8.6.4
- 7. Release notes for version 8.6.5
- 8. Using GHCi
- 8.1. Introduction to GHCi
- 8.2. Loading source files
- 8.3. Loading compiled code
- 8.4. Interactive evaluation at the prompt
- 8.4.1. I/O actions at the prompt
- 8.4.2. Using
do
notation at the prompt - 8.4.3. Multiline input
- 8.4.4. Type, class and other declarations
- 8.4.5. What’s really in scope at the prompt?
- 8.4.6. The
:main
and:run
commands - 8.4.7. The
it
variable - 8.4.8. Type defaulting in GHCi
- 8.4.9. Using a custom interactive printing function
- 8.4.10. Stack Traces in GHCi
- 8.5. The GHCi Debugger
- 8.6. Invoking GHCi
- 8.7. GHCi commands
- 8.8. The
:set
and:seti
commands - 8.9. The
.ghci
and.haskeline
files - 8.10. Compiling to object code inside GHCi
- 8.11. Running the interpreter in a separate process
- 8.12. FAQ and Things To Watch Out For
- 9. Using runghc
- 10. Using GHC
- 10.1. Using GHC
- 10.2. Warnings and sanity-checking
- 10.3. Optimisation (code improvement)
- 10.4. Using Concurrent Haskell
- 10.5. Using SMP parallelism
- 10.6. Flag reference
- 10.6.1. Verbosity options
- 10.6.2. Alternative modes of operation
- 10.6.3. Which phases to run
- 10.6.4. Redirecting output
- 10.6.5. Keeping intermediate files
- 10.6.6. Temporary files
- 10.6.7. Finding imports
- 10.6.8. Interface file options
- 10.6.9. Recompilation checking
- 10.6.10. Interactive-mode options
- 10.6.11. Packages
- 10.6.12. Language options
- 10.6.13. Warnings
- 10.6.14. Optimisation levels
- 10.6.15. Individual optimisations
- 10.6.16. Profiling options
- 10.6.17. Program coverage options
- 10.6.18. C pre-processor options
- 10.6.19. Code generation options
- 10.6.20. Linking options
- 10.6.21. Plugin options
- 10.6.22. Replacing phases
- 10.6.23. Forcing options to particular phases
- 10.6.24. Platform-specific options
- 10.6.25. Compiler debugging options
- 10.6.26. Miscellaneous compiler options
- 10.7. Running a compiled program
- 10.7.1. Setting RTS options
- 10.7.2. Miscellaneous RTS options
- 10.7.3. RTS options to control the garbage collector
- 10.7.4. RTS options to produce runtime statistics
- 10.7.5. RTS options for concurrency and parallelism
- 10.7.6. RTS options for profiling
- 10.7.7. Tracing
- 10.7.8. RTS options for hackers, debuggers, and over-interested souls
- 10.7.9. Getting information about the RTS
- 10.8. Filenames and separate compilation
- 10.8.1. Haskell source files
- 10.8.2. Output files
- 10.8.3. The search path
- 10.8.4. Redirecting the compilation output(s)
- 10.8.5. Keeping Intermediate Files
- 10.8.6. Redirecting temporary files
- 10.8.7. Other options related to interface files
- 10.8.8. The recompilation checker
- 10.8.9. How to compile mutually recursive modules
- 10.8.10. Module signatures
- 10.8.11. Using
make
- 10.8.12. Dependency generation
- 10.8.13. Orphan modules and instance declarations
- 10.9. Packages
- 10.9.1. Using Packages
- 10.9.2. The
main
package - 10.9.3. Consequences of packages for the Haskell language
- 10.9.4. Thinning and renaming modules
- 10.9.5. Package Databases
- 10.9.6. Installed package IDs, dependencies, and broken packages
- 10.9.7. Package management (the
ghc-pkg
command) - 10.9.8. Building a package from Haskell source
- 10.9.9.
InstalledPackageInfo
: a package specification
- 10.10. GHC Backends
- 10.11. Options related to a particular phase
- 10.12. Using shared libraries
- 10.13. Debugging the compiler
- 11. Profiling
- 11.1. Cost centres and cost-centre stacks
- 11.2. Compiler options for profiling
- 11.3. Time and allocation profiling
- 11.4. Profiling memory usage
- 11.5.
hp2ps
– Rendering heap profiles to PostScript - 11.6. Profiling Parallel and Concurrent Programs
- 11.7. Observing Code Coverage
- 11.8. Using “ticky-ticky” profiling (for implementors)
- 12. Advice on: sooner, faster, smaller, thriftier
- 13. GHC Language Features
- 13.1. Language options
- 13.2. Unboxed types and primitive operations
- 13.3. Syntactic extensions
- 13.3.1. Unicode syntax
- 13.3.2. The magic hash
- 13.3.3. Negative literals
- 13.3.4. Fractional looking integer literals
- 13.3.5. Binary integer literals
- 13.3.6. Hexadecimal floating point literals
- 13.3.7. Numeric underscores
- 13.3.8. Pattern guards
- 13.3.9. View patterns
- 13.3.10. n+k patterns
- 13.3.11. The recursive do-notation
- 13.3.12. Applicative do-notation
- 13.3.13. Parallel List Comprehensions
- 13.3.14. Generalised (SQL-like) List Comprehensions
- 13.3.15. Monad comprehensions
- 13.3.16. New monadic failure desugaring mechanism
- 13.3.17. Rebindable syntax and the implicit Prelude import
- 13.3.18. Postfix operators
- 13.3.19. Tuple sections
- 13.3.20. Lambda-case
- 13.3.21. Empty case alternatives
- 13.3.22. Multi-way if-expressions
- 13.3.23. Local Fixity Declarations
- 13.3.24. Import and export extensions
- 13.3.25. More liberal syntax for function arguments
- 13.3.26. Summary of stolen syntax
- 13.4. Extensions to data types and type synonyms
- 13.4.1. Data types with no constructors
- 13.4.2. Data type contexts
- 13.4.3. Infix type constructors, classes, and type variables
- 13.4.4. Type operators
- 13.4.5. Liberalised type synonyms
- 13.4.6. Existentially quantified data constructors
- 13.4.7. Declaring data types with explicit constructor signatures
- 13.4.8. Generalised Algebraic Data Types (GADTs)
- 13.5. Extensions to the record system
- 13.6. Extensions to the “deriving” mechanism
- 13.6.1. Deriving instances for empty data types
- 13.6.2. Inferred context for deriving clauses
- 13.6.3. Stand-alone deriving declarations
- 13.6.4. Deriving instances of extra classes (
Data
, etc.) - 13.6.5. Generalised derived instances for newtypes
- 13.6.6. Deriving any other class
- 13.6.7. Deriving strategies
- 13.6.8. Deriving via
- 13.7. Pattern synonyms
- 13.8. Class and instances declarations
- 13.9. Type families
- 13.10. Datatype promotion
- 13.11. Kind polymorphism
- 13.11.1. Overview of kind polymorphism
- 13.11.2. Overview of Type-in-Type
- 13.11.3. Principles of kind inference
- 13.11.4. Complete user-supplied kind signatures and polymorphic recursion
- 13.11.5. Kind inference in closed type families
- 13.11.6. Kind inference in class instance declarations
- 13.11.7. Kind inference in type signatures
- 13.11.8. Explicit kind quantification
- 13.11.9. Kind-indexed GADTs
- 13.11.10. Higher-rank kinds
- 13.11.11. Constraints in kinds
- 13.11.12. The kind
Type
- 13.11.13. Inferring dependency in datatype declarations
- 13.11.14. Inferring dependency in user-written
forall
s - 13.11.15. Kind defaulting without
PolyKinds
- 13.11.16. Pretty-printing in the presence of kind polymorphism
- 13.12. Levity polymorphism
- 13.13. Type-Level Literals
- 13.14. Equality constraints, Coercible, and the kind Constraint
- 13.15. Quantified constraints
- 13.16. Extensions to type signatures
- 13.17. Lexically scoped type variables
- 13.18. Bindings and generalisation
- 13.19. Visible type application
- 13.20. Implicit parameters
- 13.21. Arbitrary-rank polymorphism
- 13.22. Impredicative polymorphism
- 13.23. Typed Holes
- 13.24. Partial Type Signatures
- 13.25. Custom compile-time errors
- 13.26. Deferring type errors to runtime
- 13.27. Template Haskell
- 13.28. Arrow notation
- 13.29. Bang patterns and Strict Haskell
- 13.30. Assertions
- 13.31. Static pointers
- 13.32. Pragmas
- 13.32.1.
LANGUAGE
pragma - 13.32.2.
OPTIONS_GHC
pragma - 13.32.3.
INCLUDE
pragma - 13.32.4.
WARNING
andDEPRECATED
pragmas - 13.32.5.
MINIMAL
pragma - 13.32.6.
INLINE
andNOINLINE
pragmas - 13.32.7.
LINE
pragma - 13.32.8.
COLUMN
pragma - 13.32.9.
RULES
pragma - 13.32.10.
SPECIALIZE
pragma - 13.32.11.
SPECIALIZE
instance pragma - 13.32.12.
UNPACK
pragma - 13.32.13.
NOUNPACK
pragma - 13.32.14.
SOURCE
pragma - 13.32.15.
COMPLETE
pragmas - 13.32.16. Disambiguating between multiple
COMPLETE
pragmas - 13.32.17.
OVERLAPPING
,OVERLAPPABLE
,OVERLAPS
, andINCOHERENT
pragmas
- 13.32.1.
- 13.33. Rewrite rules
- 13.34. Special built-in functions
- 13.35. Generic classes
- 13.36. Generic programming
- 13.37. Roles
- 13.38. HasCallStack
- 13.39. Concurrent and Parallel Haskell
- 13.40. Safe Haskell
- 14. Foreign function interface (FFI)
- 14.1. GHC differences to the FFI Chapter
- 14.2. GHC extensions to the FFI Chapter
- 14.3. Using the FFI with GHC
- 15. Extending and using GHC as a Library
- 16. What to do when something goes wrong
- 17. Debugging compiled programs
- 18. Other Haskell utility programs
- 19. Running GHC on Win32 systems
- 20. Known bugs and infelicities
- 20.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 20.1.1. Divergence from Haskell 98 and Haskell 2010
- 20.1.1.1. Lexical syntax
- 20.1.1.2. Context-free syntax
- 20.1.1.3. Expressions and patterns
- 20.1.1.4. Declarations and bindings
- 20.1.1.5. Typechecking of recursive binding groups
- 20.1.1.6. Module system and interface files
- 20.1.1.7. Numbers, basic types, and built-in classes
- 20.1.1.8. In
Prelude
support - 20.1.1.9. The Foreign Function Interface
- 20.1.1.10. Operator sections
- 20.1.2. GHC’s interpretation of undefined behaviour in Haskell 98 and Haskell 2010
- 20.1.1. Divergence from Haskell 98 and Haskell 2010
- 20.2. Known bugs or infelicities
- 20.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 21. Eventlog encodings
- 22. Care and feeding of your GHC User’s Guide