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. Using GHCi
- 7.1. Introduction to GHCi
- 7.2. Loading source files
- 7.3. Loading compiled code
- 7.4. Interactive evaluation at the prompt
- 7.4.1. I/O actions at the prompt
- 7.4.2. Using
do
notation at the prompt - 7.4.3. Multiline input
- 7.4.4. Type, class and other declarations
- 7.4.5. What’s really in scope at the prompt?
- 7.4.6. The
:main
and:run
commands - 7.4.7. The
it
variable - 7.4.8. Type defaulting in GHCi
- 7.4.9. Using a custom interactive printing function
- 7.4.10. Stack Traces in GHCi
- 7.5. The GHCi Debugger
- 7.6. Invoking GHCi
- 7.7. GHCi commands
- 7.8. The
:set
and:seti
commands - 7.9. The
.ghci
and.haskeline
files - 7.10. Compiling to object code inside GHCi
- 7.11. Running the interpreter in a separate process
- 7.12. Running the interpreter on a different host
- 7.13. FAQ and Things To Watch Out For
- 8. Using runghc
- 9. Using GHC
- 9.1. Using GHC
- 9.2. Warnings and sanity-checking
- 9.3. Optimisation (code improvement)
- 9.4. Using Concurrent Haskell
- 9.5. Using SMP parallelism
- 9.6. Flag reference
- 9.6.1. Verbosity options
- 9.6.2. Alternative modes of operation
- 9.6.3. Which phases to run
- 9.6.4. Redirecting output
- 9.6.5. Keeping intermediate files
- 9.6.6. Temporary files
- 9.6.7. Finding imports
- 9.6.8. Interface file options
- 9.6.9. Recompilation checking
- 9.6.10. Interactive-mode options
- 9.6.11. Packages
- 9.6.12. Language options
- 9.6.13. Warnings
- 9.6.14. Optimisation levels
- 9.6.15. Individual optimisations
- 9.6.16. Profiling options
- 9.6.17. Program coverage options
- 9.6.18. C pre-processor options
- 9.6.19. Code generation options
- 9.6.20. Linking options
- 9.6.21. Plugin options
- 9.6.22. Replacing phases
- 9.6.23. Forcing options to particular phases
- 9.6.24. Platform-specific options
- 9.6.25. Compiler debugging options
- 9.6.26. Miscellaneous compiler options
- 9.7. Running a compiled program
- 9.7.1. Setting RTS options
- 9.7.2. Miscellaneous RTS options
- 9.7.3. RTS options to control the garbage collector
- 9.7.4. RTS options to produce runtime statistics
- 9.7.5. RTS options for concurrency and parallelism
- 9.7.6. RTS options for profiling
- 9.7.7. Tracing
- 9.7.8. RTS options for hackers, debuggers, and over-interested souls
- 9.7.9. Getting information about the RTS
- 9.8. Filenames and separate compilation
- 9.8.1. Haskell source files
- 9.8.2. Output files
- 9.8.3. The search path
- 9.8.4. Redirecting the compilation output(s)
- 9.8.5. Keeping Intermediate Files
- 9.8.6. Redirecting temporary files
- 9.8.7. Other options related to interface files
- 9.8.8. Options related to extended interface files
- 9.8.9. The recompilation checker
- 9.8.10. How to compile mutually recursive modules
- 9.8.11. Module signatures
- 9.8.12. Using
make
- 9.8.13. Dependency generation
- 9.8.14. Orphan modules and instance declarations
- 9.9. Packages
- 9.9.1. Using Packages
- 9.9.2. The
main
package - 9.9.3. Consequences of packages for the Haskell language
- 9.9.4. Thinning and renaming modules
- 9.9.5. Package Databases
- 9.9.6. Installed package IDs, dependencies, and broken packages
- 9.9.7. Package management (the
ghc-pkg
command) - 9.9.8. Building a package from Haskell source
- 9.9.9.
InstalledPackageInfo
: a package specification
- 9.10. GHC Backends
- 9.11. Options related to a particular phase
- 9.12. Using shared libraries
- 9.13. Debugging the compiler
- 10. Profiling
- 10.1. Cost centres and cost-centre stacks
- 10.2. Compiler options for profiling
- 10.3. Time and allocation profiling
- 10.4. Profiling memory usage
- 10.5.
hp2ps
– Rendering heap profiles to PostScript - 10.6. Profiling Parallel and Concurrent Programs
- 10.7. Observing Code Coverage
- 10.8. Using “ticky-ticky” profiling (for implementors)
- 11. Advice on: sooner, faster, smaller, thriftier
- 12. GHC Language Features
- 12.1. Language options
- 12.2. Unboxed types and primitive operations
- 12.3. Syntactic extensions
- 12.3.1. Unicode syntax
- 12.3.2. The magic hash
- 12.3.3. Negative literals
- 12.3.4. Fractional looking integer literals
- 12.3.5. Binary integer literals
- 12.3.6. Hexadecimal floating point literals
- 12.3.7. Numeric underscores
- 12.3.8. Pattern guards
- 12.3.9. View patterns
- 12.3.10. n+k patterns
- 12.3.11. The recursive do-notation
- 12.3.12. Applicative do-notation
- 12.3.13. Parallel List Comprehensions
- 12.3.14. Generalised (SQL-like) List Comprehensions
- 12.3.15. Monad comprehensions
- 12.3.16. New monadic failure desugaring mechanism
- 12.3.17. Rebindable syntax and the implicit Prelude import
- 12.3.18. Postfix operators
- 12.3.19. Tuple sections
- 12.3.20. Lambda-case
- 12.3.21. Empty case alternatives
- 12.3.22. Multi-way if-expressions
- 12.3.23. Local Fixity Declarations
- 12.3.24. Import and export extensions
- 12.3.25. More liberal syntax for function arguments
- 12.3.26. Summary of stolen syntax
- 12.4. Extensions to data types and type synonyms
- 12.4.1. Data types with no constructors
- 12.4.2. Data type contexts
- 12.4.3. Infix type constructors, classes, and type variables
- 12.4.4. Type operators
- 12.4.5. Liberalised type synonyms
- 12.4.6. Existentially quantified data constructors
- 12.4.7. Declaring data types with explicit constructor signatures
- 12.4.8. Generalised Algebraic Data Types (GADTs)
- 12.5. Extensions to the record system
- 12.6. Extensions to the “deriving” mechanism
- 12.6.1. Deriving instances for empty data types
- 12.6.2. Inferred context for deriving clauses
- 12.6.3. Stand-alone deriving declarations
- 12.6.4. Deriving instances of extra classes (
Data
, etc.) - 12.6.5. Generalised derived instances for newtypes
- 12.6.6. Deriving any other class
- 12.6.7. Deriving strategies
- 12.6.8. Deriving via
- 12.7. Pattern synonyms
- 12.8. Class and instances declarations
- 12.9. Type families
- 12.10. Datatype promotion
- 12.11. Kind polymorphism
- 12.11.1. Overview of kind polymorphism
- 12.11.2. Overview of Type-in-Type
- 12.11.3. Principles of kind inference
- 12.11.4. Inferring the order of variables in a type/class declaration
- 12.11.5. Complete user-supplied kind signatures and polymorphic recursion
- 12.11.6. Standalone kind signatures and polymorphic recursion
- 12.11.7. Standalone kind signatures and declaration headers
- 12.11.8. Kind inference in closed type families
- 12.11.9. Kind inference in class instance declarations
- 12.11.10. Kind inference in type signatures
- 12.11.11. Explicit kind quantification
- 12.11.12. Implicit quantification in type synonyms and type family instances
- 12.11.13. Kind-indexed GADTs
- 12.11.14. Higher-rank kinds
- 12.11.15. Constraints in kinds
- 12.11.16. The kind
Type
- 12.11.17. Inferring dependency in datatype declarations
- 12.11.18. Inferring dependency in user-written
forall
s - 12.11.19. Kind defaulting without
PolyKinds
- 12.11.20. Pretty-printing in the presence of kind polymorphism
- 12.12. Levity polymorphism
- 12.13. Type-Level Literals
- 12.14. Equality constraints, Coercible, and the kind Constraint
- 12.15. Quantified constraints
- 12.16. Extensions to type signatures
- 12.17. Lexically scoped type variables
- 12.18. Bindings and generalisation
- 12.19. Visible type application
- 12.20. Implicit parameters
- 12.21. Arbitrary-rank polymorphism
- 12.22. Impredicative polymorphism
- 12.23. Typed Holes
- 12.24. Partial Type Signatures
- 12.25. Custom compile-time errors
- 12.26. Deferring type errors to runtime
- 12.27. Template Haskell
- 12.28. Arrow notation
- 12.29. Bang patterns and Strict Haskell
- 12.30. Assertions
- 12.31. Static pointers
- 12.32. Pragmas
- 12.32.1.
LANGUAGE
pragma - 12.32.2.
OPTIONS_GHC
pragma - 12.32.3.
INCLUDE
pragma - 12.32.4.
WARNING
andDEPRECATED
pragmas - 12.32.5.
MINIMAL
pragma - 12.32.6.
INLINE
andNOINLINE
pragmas - 12.32.7.
LINE
pragma - 12.32.8.
COLUMN
pragma - 12.32.9.
RULES
pragma - 12.32.10.
SPECIALIZE
pragma - 12.32.11.
SPECIALIZE
instance pragma - 12.32.12.
UNPACK
pragma - 12.32.13.
NOUNPACK
pragma - 12.32.14.
SOURCE
pragma - 12.32.15.
COMPLETE
pragmas - 12.32.16.
OVERLAPPING
,OVERLAPPABLE
,OVERLAPS
, andINCOHERENT
pragmas
- 12.32.1.
- 12.33. Rewrite rules
- 12.34. Special built-in functions
- 12.35. Generic classes
- 12.36. Generic programming
- 12.37. Roles
- 12.38. HasCallStack
- 12.39. Concurrent and Parallel Haskell
- 12.40. Safe Haskell
- 13. Foreign function interface (FFI)
- 13.1. GHC differences to the FFI Chapter
- 13.2. GHC extensions to the FFI Chapter
- 13.3. Using the FFI with GHC
- 14. Extending and using GHC as a Library
- 14.1. Source annotations
- 14.2. Using GHC as a Library
- 14.3. Compiler Plugins
- 15. What to do when something goes wrong
- 16. Debugging compiled programs
- 17. Other Haskell utility programs
- 18. Running GHC on Win32 systems
- 19. Known bugs and infelicities
- 19.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 19.1.1. Divergence from Haskell 98 and Haskell 2010
- 19.1.1.1. Lexical syntax
- 19.1.1.2. Context-free syntax
- 19.1.1.3. Expressions and patterns
- 19.1.1.4. Declarations and bindings
- 19.1.1.5. Typechecking of recursive binding groups
- 19.1.1.6. Default Module headers with -main-is
- 19.1.1.7. Module system and interface files
- 19.1.1.8. Numbers, basic types, and built-in classes
- 19.1.1.9. In
Prelude
support - 19.1.1.10. The Foreign Function Interface
- 19.1.1.11. Operator sections
- 19.1.2. GHC’s interpretation of undefined behaviour in Haskell 98 and Haskell 2010
- 19.1.1. Divergence from Haskell 98 and Haskell 2010
- 19.2. Known bugs or infelicities
- 19.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 20. Eventlog encodings
- 21. Care and feeding of your GHC User’s Guide