Welcome to the GHC User’s Guide¶
Contents:
- 1. The Glasgow Haskell Compiler License
- 2. Introduction to GHC
- 3. Release notes for version 8.10.1
- 4. Release notes for version 8.10.2
- 5. Release notes for version 8.10.3
- 6. Release notes for version 8.10.4
- 7. Release notes for version 8.10.5
- 8. Release notes for version 8.10.6
- 9. Using GHCi
- 9.1. Introduction to GHCi
- 9.2. Loading source files
- 9.3. Loading compiled code
- 9.4. Interactive evaluation at the prompt
- 9.4.1. I/O actions at the prompt
- 9.4.2. Using
do
notation at the prompt - 9.4.3. Multiline input
- 9.4.4. Type, class and other declarations
- 9.4.5. What’s really in scope at the prompt?
- 9.4.6. The
:main
and:run
commands - 9.4.7. The
it
variable - 9.4.8. Type defaulting in GHCi
- 9.4.9. Using a custom interactive printing function
- 9.4.10. Stack Traces in GHCi
- 9.5. The GHCi Debugger
- 9.6. Invoking GHCi
- 9.7. GHCi commands
- 9.8. The
:set
and:seti
commands - 9.9. The
.ghci
and.haskeline
files - 9.10. Compiling to object code inside GHCi
- 9.11. Running the interpreter in a separate process
- 9.12. Running the interpreter on a different host
- 9.13. FAQ and Things To Watch Out For
- 10. Using runghc
- 11. Using GHC
- 11.1. Using GHC
- 11.2. Warnings and sanity-checking
- 11.3. Optimisation (code improvement)
- 11.4. Using Concurrent Haskell
- 11.5. Using SMP parallelism
- 11.6. Flag reference
- 11.6.1. Verbosity options
- 11.6.2. Alternative modes of operation
- 11.6.3. Which phases to run
- 11.6.4. Redirecting output
- 11.6.5. Keeping intermediate files
- 11.6.6. Temporary files
- 11.6.7. Finding imports
- 11.6.8. Interface file options
- 11.6.9. Recompilation checking
- 11.6.10. Interactive-mode options
- 11.6.11. Packages
- 11.6.12. Language options
- 11.6.13. Warnings
- 11.6.14. Optimisation levels
- 11.6.15. Individual optimisations
- 11.6.16. Profiling options
- 11.6.17. Program coverage options
- 11.6.18. C pre-processor options
- 11.6.19. Code generation options
- 11.6.20. Linking options
- 11.6.21. Plugin options
- 11.6.22. Replacing phases
- 11.6.23. Forcing options to particular phases
- 11.6.24. Platform-specific options
- 11.6.25. Compiler debugging options
- 11.6.26. Miscellaneous compiler options
- 11.7. Running a compiled program
- 11.7.1. Setting RTS options
- 11.7.2. Miscellaneous RTS options
- 11.7.3. RTS options to control the garbage collector
- 11.7.4. RTS options to produce runtime statistics
- 11.7.5. RTS options for concurrency and parallelism
- 11.7.6. RTS options for profiling
- 11.7.7. Tracing
- 11.7.8. RTS options for hackers, debuggers, and over-interested souls
- 11.7.9. Getting information about the RTS
- 11.8. Filenames and separate compilation
- 11.8.1. Haskell source files
- 11.8.2. Output files
- 11.8.3. The search path
- 11.8.4. Redirecting the compilation output(s)
- 11.8.5. Keeping Intermediate Files
- 11.8.6. Redirecting temporary files
- 11.8.7. Other options related to interface files
- 11.8.8. Options related to extended interface files
- 11.8.9. The recompilation checker
- 11.8.10. How to compile mutually recursive modules
- 11.8.11. Module signatures
- 11.8.12. Using
make
- 11.8.13. Dependency generation
- 11.8.14. Orphan modules and instance declarations
- 11.9. Packages
- 11.9.1. Using Packages
- 11.9.2. The
main
package - 11.9.3. Consequences of packages for the Haskell language
- 11.9.4. Thinning and renaming modules
- 11.9.5. Package Databases
- 11.9.6. Installed package IDs, dependencies, and broken packages
- 11.9.7. Package management (the
ghc-pkg
command) - 11.9.8. Building a package from Haskell source
- 11.9.9.
InstalledPackageInfo
: a package specification
- 11.10. GHC Backends
- 11.11. Options related to a particular phase
- 11.12. Using shared libraries
- 11.13. Debugging the compiler
- 12. Profiling
- 12.1. Cost centres and cost-centre stacks
- 12.2. Compiler options for profiling
- 12.3. Time and allocation profiling
- 12.4. Profiling memory usage
- 12.5.
hp2ps
– Rendering heap profiles to PostScript - 12.6. Profiling Parallel and Concurrent Programs
- 12.7. Observing Code Coverage
- 12.8. Using “ticky-ticky” profiling (for implementors)
- 13. Advice on: sooner, faster, smaller, thriftier
- 14. GHC Language Features
- 14.1. Language options
- 14.2. Unboxed types and primitive operations
- 14.3. Syntactic extensions
- 14.3.1. Unicode syntax
- 14.3.2. The magic hash
- 14.3.3. Negative literals
- 14.3.4. Fractional looking integer literals
- 14.3.5. Binary integer literals
- 14.3.6. Hexadecimal floating point literals
- 14.3.7. Numeric underscores
- 14.3.8. Pattern guards
- 14.3.9. View patterns
- 14.3.10. n+k patterns
- 14.3.11. The recursive do-notation
- 14.3.12. Applicative do-notation
- 14.3.13. Parallel List Comprehensions
- 14.3.14. Generalised (SQL-like) List Comprehensions
- 14.3.15. Monad comprehensions
- 14.3.16. New monadic failure desugaring mechanism
- 14.3.17. Rebindable syntax and the implicit Prelude import
- 14.3.18. Postfix operators
- 14.3.19. Tuple sections
- 14.3.20. Lambda-case
- 14.3.21. Empty case alternatives
- 14.3.22. Multi-way if-expressions
- 14.3.23. Local Fixity Declarations
- 14.3.24. Import and export extensions
- 14.3.25. More liberal syntax for function arguments
- 14.3.26. Summary of stolen syntax
- 14.4. Extensions to data types and type synonyms
- 14.4.1. Data types with no constructors
- 14.4.2. Data type contexts
- 14.4.3. Infix type constructors, classes, and type variables
- 14.4.4. Type operators
- 14.4.5. Liberalised type synonyms
- 14.4.6. Existentially quantified data constructors
- 14.4.7. Declaring data types with explicit constructor signatures
- 14.4.8. Generalised Algebraic Data Types (GADTs)
- 14.5. Extensions to the record system
- 14.6. Extensions to the “deriving” mechanism
- 14.6.1. Deriving instances for empty data types
- 14.6.2. Inferred context for deriving clauses
- 14.6.3. Stand-alone deriving declarations
- 14.6.4. Deriving instances of extra classes (
Data
, etc.) - 14.6.5. Generalised derived instances for newtypes
- 14.6.6. Deriving any other class
- 14.6.7. Deriving strategies
- 14.6.8. Deriving via
- 14.7. Pattern synonyms
- 14.8. Class and instances declarations
- 14.9. Type families
- 14.10. Datatype promotion
- 14.11. Kind polymorphism
- 14.11.1. Overview of kind polymorphism
- 14.11.2. Overview of Type-in-Type
- 14.11.3. Principles of kind inference
- 14.11.4. Inferring the order of variables in a type/class declaration
- 14.11.5. Complete user-supplied kind signatures and polymorphic recursion
- 14.11.6. Standalone kind signatures and polymorphic recursion
- 14.11.7. Standalone kind signatures and declaration headers
- 14.11.8. Kind inference in closed type families
- 14.11.9. Kind inference in class instance declarations
- 14.11.10. Kind inference in type signatures
- 14.11.11. Explicit kind quantification
- 14.11.12. Implicit quantification in type synonyms and type family instances
- 14.11.13. Kind-indexed GADTs
- 14.11.14. Higher-rank kinds
- 14.11.15. Constraints in kinds
- 14.11.16. The kind
Type
- 14.11.17. Inferring dependency in datatype declarations
- 14.11.18. Inferring dependency in user-written
forall
s - 14.11.19. Kind defaulting without
PolyKinds
- 14.11.20. Pretty-printing in the presence of kind polymorphism
- 14.12. Levity polymorphism
- 14.13. Type-Level Literals
- 14.14. Equality constraints, Coercible, and the kind Constraint
- 14.15. Quantified constraints
- 14.16. Extensions to type signatures
- 14.17. Lexically scoped type variables
- 14.18. Bindings and generalisation
- 14.19. Visible type application
- 14.20. Implicit parameters
- 14.21. Arbitrary-rank polymorphism
- 14.22. Impredicative polymorphism
- 14.23. Typed Holes
- 14.24. Partial Type Signatures
- 14.25. Custom compile-time errors
- 14.26. Deferring type errors to runtime
- 14.27. Template Haskell
- 14.28. Arrow notation
- 14.29. Bang patterns and Strict Haskell
- 14.30. Assertions
- 14.31. Static pointers
- 14.32. Pragmas
- 14.32.1.
LANGUAGE
pragma - 14.32.2.
OPTIONS_GHC
pragma - 14.32.3.
INCLUDE
pragma - 14.32.4.
WARNING
andDEPRECATED
pragmas - 14.32.5.
MINIMAL
pragma - 14.32.6.
INLINE
andNOINLINE
pragmas - 14.32.7.
LINE
pragma - 14.32.8.
COLUMN
pragma - 14.32.9.
RULES
pragma - 14.32.10.
SPECIALIZE
pragma - 14.32.11.
SPECIALIZE
instance pragma - 14.32.12.
UNPACK
pragma - 14.32.13.
NOUNPACK
pragma - 14.32.14.
SOURCE
pragma - 14.32.15.
COMPLETE
pragmas - 14.32.16.
OVERLAPPING
,OVERLAPPABLE
,OVERLAPS
, andINCOHERENT
pragmas
- 14.32.1.
- 14.33. Rewrite rules
- 14.34. Special built-in functions
- 14.35. Generic classes
- 14.36. Generic programming
- 14.37. Roles
- 14.38. HasCallStack
- 14.39. Concurrent and Parallel Haskell
- 14.40. Safe Haskell
- 15. Foreign function interface (FFI)
- 15.1. GHC differences to the FFI Chapter
- 15.2. GHC extensions to the FFI Chapter
- 15.3. Using the FFI with GHC
- 16. Extending and using GHC as a Library
- 16.1. Source annotations
- 16.2. Using GHC as a Library
- 16.3. Compiler Plugins
- 17. What to do when something goes wrong
- 18. Debugging compiled programs
- 19. Other Haskell utility programs
- 20. Running GHC on Win32 systems
- 21. Known bugs and infelicities
- 21.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 21.1.1. Divergence from Haskell 98 and Haskell 2010
- 21.1.1.1. Lexical syntax
- 21.1.1.2. Context-free syntax
- 21.1.1.3. Expressions and patterns
- 21.1.1.4. Declarations and bindings
- 21.1.1.5. Typechecking of recursive binding groups
- 21.1.1.6. Default Module headers with -main-is
- 21.1.1.7. Module system and interface files
- 21.1.1.8. Numbers, basic types, and built-in classes
- 21.1.1.9. In
Prelude
support - 21.1.1.10. The Foreign Function Interface
- 21.1.1.11. Operator sections
- 21.1.2. GHC’s interpretation of undefined behaviour in Haskell 98 and Haskell 2010
- 21.1.1. Divergence from Haskell 98 and Haskell 2010
- 21.2. Known bugs or infelicities
- 21.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 22. Eventlog encodings
- 23. Care and feeding of your GHC User’s Guide