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. Release notes for version 8.10.7
- 10. Using GHCi
- 10.1. Introduction to GHCi
- 10.2. Loading source files
- 10.3. Loading compiled code
- 10.4. Interactive evaluation at the prompt
- 10.4.1. I/O actions at the prompt
- 10.4.2. Using
do
notation at the prompt - 10.4.3. Multiline input
- 10.4.4. Type, class and other declarations
- 10.4.5. What’s really in scope at the prompt?
- 10.4.6. The
:main
and:run
commands - 10.4.7. The
it
variable - 10.4.8. Type defaulting in GHCi
- 10.4.9. Using a custom interactive printing function
- 10.4.10. Stack Traces in GHCi
- 10.5. The GHCi Debugger
- 10.6. Invoking GHCi
- 10.7. GHCi commands
- 10.8. The
:set
and:seti
commands - 10.9. The
.ghci
and.haskeline
files - 10.10. Compiling to object code inside GHCi
- 10.11. Running the interpreter in a separate process
- 10.12. Running the interpreter on a different host
- 10.13. FAQ and Things To Watch Out For
- 11. Using runghc
- 12. Using GHC
- 12.1. Using GHC
- 12.2. Warnings and sanity-checking
- 12.3. Optimisation (code improvement)
- 12.4. Using Concurrent Haskell
- 12.5. Using SMP parallelism
- 12.6. Flag reference
- 12.6.1. Verbosity options
- 12.6.2. Alternative modes of operation
- 12.6.3. Which phases to run
- 12.6.4. Redirecting output
- 12.6.5. Keeping intermediate files
- 12.6.6. Temporary files
- 12.6.7. Finding imports
- 12.6.8. Interface file options
- 12.6.9. Recompilation checking
- 12.6.10. Interactive-mode options
- 12.6.11. Packages
- 12.6.12. Language options
- 12.6.13. Warnings
- 12.6.14. Optimisation levels
- 12.6.15. Individual optimisations
- 12.6.16. Profiling options
- 12.6.17. Program coverage options
- 12.6.18. C pre-processor options
- 12.6.19. Code generation options
- 12.6.20. Linking options
- 12.6.21. Plugin options
- 12.6.22. Replacing phases
- 12.6.23. Forcing options to particular phases
- 12.6.24. Platform-specific options
- 12.6.25. Compiler debugging options
- 12.6.26. Miscellaneous compiler options
- 12.7. Running a compiled program
- 12.7.1. Setting RTS options
- 12.7.2. Miscellaneous RTS options
- 12.7.3. RTS options to control the garbage collector
- 12.7.4. RTS options to produce runtime statistics
- 12.7.5. RTS options for concurrency and parallelism
- 12.7.6. RTS options for profiling
- 12.7.7. Tracing
- 12.7.8. RTS options for hackers, debuggers, and over-interested souls
- 12.7.9. Getting information about the RTS
- 12.8. Filenames and separate compilation
- 12.8.1. Haskell source files
- 12.8.2. Output files
- 12.8.3. The search path
- 12.8.4. Redirecting the compilation output(s)
- 12.8.5. Keeping Intermediate Files
- 12.8.6. Redirecting temporary files
- 12.8.7. Other options related to interface files
- 12.8.8. Options related to extended interface files
- 12.8.9. The recompilation checker
- 12.8.10. How to compile mutually recursive modules
- 12.8.11. Module signatures
- 12.8.12. Using
make
- 12.8.13. Dependency generation
- 12.8.14. Orphan modules and instance declarations
- 12.9. Packages
- 12.9.1. Using Packages
- 12.9.2. The
main
package - 12.9.3. Consequences of packages for the Haskell language
- 12.9.4. Thinning and renaming modules
- 12.9.5. Package Databases
- 12.9.6. Installed package IDs, dependencies, and broken packages
- 12.9.7. Package management (the
ghc-pkg
command) - 12.9.8. Building a package from Haskell source
- 12.9.9.
InstalledPackageInfo
: a package specification
- 12.10. GHC Backends
- 12.11. Options related to a particular phase
- 12.12. Using shared libraries
- 12.13. Debugging the compiler
- 13. Profiling
- 13.1. Cost centres and cost-centre stacks
- 13.2. Compiler options for profiling
- 13.3. Time and allocation profiling
- 13.4. Profiling memory usage
- 13.5.
hp2ps
– Rendering heap profiles to PostScript - 13.6. Profiling Parallel and Concurrent Programs
- 13.7. Observing Code Coverage
- 13.8. Using “ticky-ticky” profiling (for implementors)
- 14. Advice on: sooner, faster, smaller, thriftier
- 15. GHC Language Features
- 15.1. Language options
- 15.2. Unboxed types and primitive operations
- 15.3. Syntactic extensions
- 15.3.1. Unicode syntax
- 15.3.2. The magic hash
- 15.3.3. Negative literals
- 15.3.4. Fractional looking integer literals
- 15.3.5. Binary integer literals
- 15.3.6. Hexadecimal floating point literals
- 15.3.7. Numeric underscores
- 15.3.8. Pattern guards
- 15.3.9. View patterns
- 15.3.10. n+k patterns
- 15.3.11. The recursive do-notation
- 15.3.12. Applicative do-notation
- 15.3.13. Parallel List Comprehensions
- 15.3.14. Generalised (SQL-like) List Comprehensions
- 15.3.15. Monad comprehensions
- 15.3.16. New monadic failure desugaring mechanism
- 15.3.17. Rebindable syntax and the implicit Prelude import
- 15.3.18. Postfix operators
- 15.3.19. Tuple sections
- 15.3.20. Lambda-case
- 15.3.21. Empty case alternatives
- 15.3.22. Multi-way if-expressions
- 15.3.23. Local Fixity Declarations
- 15.3.24. Import and export extensions
- 15.3.25. More liberal syntax for function arguments
- 15.3.26. Summary of stolen syntax
- 15.4. Extensions to data types and type synonyms
- 15.4.1. Data types with no constructors
- 15.4.2. Data type contexts
- 15.4.3. Infix type constructors, classes, and type variables
- 15.4.4. Type operators
- 15.4.5. Liberalised type synonyms
- 15.4.6. Existentially quantified data constructors
- 15.4.7. Declaring data types with explicit constructor signatures
- 15.4.8. Generalised Algebraic Data Types (GADTs)
- 15.5. Extensions to the record system
- 15.6. Extensions to the “deriving” mechanism
- 15.6.1. Deriving instances for empty data types
- 15.6.2. Inferred context for deriving clauses
- 15.6.3. Stand-alone deriving declarations
- 15.6.4. Deriving instances of extra classes (
Data
, etc.) - 15.6.5. Generalised derived instances for newtypes
- 15.6.6. Deriving any other class
- 15.6.7. Deriving strategies
- 15.6.8. Deriving via
- 15.7. Pattern synonyms
- 15.8. Class and instances declarations
- 15.9. Type families
- 15.10. Datatype promotion
- 15.11. Kind polymorphism
- 15.11.1. Overview of kind polymorphism
- 15.11.2. Overview of Type-in-Type
- 15.11.3. Principles of kind inference
- 15.11.4. Inferring the order of variables in a type/class declaration
- 15.11.5. Complete user-supplied kind signatures and polymorphic recursion
- 15.11.6. Standalone kind signatures and polymorphic recursion
- 15.11.7. Standalone kind signatures and declaration headers
- 15.11.8. Kind inference in closed type families
- 15.11.9. Kind inference in class instance declarations
- 15.11.10. Kind inference in type signatures
- 15.11.11. Explicit kind quantification
- 15.11.12. Implicit quantification in type synonyms and type family instances
- 15.11.13. Kind-indexed GADTs
- 15.11.14. Higher-rank kinds
- 15.11.15. Constraints in kinds
- 15.11.16. The kind
Type
- 15.11.17. Inferring dependency in datatype declarations
- 15.11.18. Inferring dependency in user-written
forall
s - 15.11.19. Kind defaulting without
PolyKinds
- 15.11.20. Pretty-printing in the presence of kind polymorphism
- 15.12. Levity polymorphism
- 15.13. Type-Level Literals
- 15.14. Equality constraints, Coercible, and the kind Constraint
- 15.15. Quantified constraints
- 15.16. Extensions to type signatures
- 15.17. Lexically scoped type variables
- 15.18. Bindings and generalisation
- 15.19. Visible type application
- 15.20. Implicit parameters
- 15.21. Arbitrary-rank polymorphism
- 15.22. Impredicative polymorphism
- 15.23. Typed Holes
- 15.24. Partial Type Signatures
- 15.25. Custom compile-time errors
- 15.26. Deferring type errors to runtime
- 15.27. Template Haskell
- 15.28. Arrow notation
- 15.29. Bang patterns and Strict Haskell
- 15.30. Assertions
- 15.31. Static pointers
- 15.32. Pragmas
- 15.32.1.
LANGUAGE
pragma - 15.32.2.
OPTIONS_GHC
pragma - 15.32.3.
INCLUDE
pragma - 15.32.4.
WARNING
andDEPRECATED
pragmas - 15.32.5.
MINIMAL
pragma - 15.32.6.
INLINE
andNOINLINE
pragmas - 15.32.7.
LINE
pragma - 15.32.8.
COLUMN
pragma - 15.32.9.
RULES
pragma - 15.32.10.
SPECIALIZE
pragma - 15.32.11.
SPECIALIZE
instance pragma - 15.32.12.
UNPACK
pragma - 15.32.13.
NOUNPACK
pragma - 15.32.14.
SOURCE
pragma - 15.32.15.
COMPLETE
pragmas - 15.32.16.
OVERLAPPING
,OVERLAPPABLE
,OVERLAPS
, andINCOHERENT
pragmas
- 15.32.1.
- 15.33. Rewrite rules
- 15.34. Special built-in functions
- 15.35. Generic classes
- 15.36. Generic programming
- 15.37. Roles
- 15.38. HasCallStack
- 15.39. Concurrent and Parallel Haskell
- 15.40. Safe Haskell
- 16. Foreign function interface (FFI)
- 16.1. GHC differences to the FFI Chapter
- 16.2. GHC extensions to the FFI Chapter
- 16.3. Using the FFI with GHC
- 17. Extending and using GHC as a Library
- 17.1. Source annotations
- 17.2. Using GHC as a Library
- 17.3. Compiler Plugins
- 18. What to do when something goes wrong
- 19. Debugging compiled programs
- 20. Other Haskell utility programs
- 21. Running GHC on Win32 systems
- 22. Known bugs and infelicities
- 22.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 22.1.1. Divergence from Haskell 98 and Haskell 2010
- 22.1.1.1. Lexical syntax
- 22.1.1.2. Context-free syntax
- 22.1.1.3. Expressions and patterns
- 22.1.1.4. Declarations and bindings
- 22.1.1.5. Typechecking of recursive binding groups
- 22.1.1.6. Default Module headers with -main-is
- 22.1.1.7. Module system and interface files
- 22.1.1.8. Numbers, basic types, and built-in classes
- 22.1.1.9. In
Prelude
support - 22.1.1.10. The Foreign Function Interface
- 22.1.1.11. Operator sections
- 22.1.2. GHC’s interpretation of undefined behaviour in Haskell 98 and Haskell 2010
- 22.1.1. Divergence from Haskell 98 and Haskell 2010
- 22.2. Known bugs or infelicities
- 22.1. Haskell standards vs. Glasgow Haskell: language non-compliance
- 23. Eventlog encodings
- 24. Care and feeding of your GHC User’s Guide