Spec-Zone.ru › Haskell 8

Welcome to the GHC User’s Guide

Contents:

  • 1. The Glasgow Haskell Compiler License
  • 2. Introduction to GHC
    • 2.1. Obtaining GHC
    • 2.2. Meta-information: Web sites, mailing lists, etc.
    • 2.3. Reporting bugs in GHC
    • 2.4. GHC version numbering policy
  • 3. Release notes for version 8.10.1
    • 3.1. Highlights
    • 3.2. Full details
      • 3.2.1. Language
      • 3.2.2. Compiler
      • 3.2.3. GHC API
      • 3.2.4. GHCi
      • 3.2.5. Runtime system
      • 3.2.6. Template Haskell
      • 3.2.7. ghc-prim library
      • 3.2.8. ghc library
      • 3.2.9. base library
      • 3.2.10. Build system
    • 3.3. Included libraries
  • 4. Release notes for version 8.10.2
    • 4.1. Highlights
    • 4.2. Full details
      • 4.2.1. Compiler
      • 4.2.2. Runtime system
      • 4.2.3. base library
      • 4.2.4. Build system
    • 4.3. Known issues
    • 4.4. Included libraries
  • 5. Using GHCi
    • 5.1. Introduction to GHCi
    • 5.2. Loading source files
      • 5.2.1. Modules vs. filenames
      • 5.2.2. Making changes and recompilation
    • 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.5.1. The effect of :load on what is in scope
        • 5.4.5.2. Controlling what is in scope with import
        • 5.4.5.3. Controlling what is in scope with the :module command
        • 5.4.5.4. Qualified names
        • 5.4.5.5. :module and :load
      • 5.4.6. The :main and :run commands
      • 5.4.7. The it variable
      • 5.4.8. Type defaulting in GHCi
        • 5.4.8.1. Interactive classes
        • 5.4.8.2. Extended rules around default declarations
      • 5.4.9. Using a custom interactive printing function
      • 5.4.10. Stack Traces in GHCi
    • 5.5. The GHCi Debugger
      • 5.5.1. Breakpoints and inspecting variables
        • 5.5.1.1. Setting breakpoints
        • 5.5.1.2. Managing breakpoints
      • 5.5.2. Single-stepping
      • 5.5.3. Nested breakpoints
      • 5.5.4. The _result variable
      • 5.5.5. Tracing and history
      • 5.5.6. Debugging exceptions
      • 5.5.7. Example: inspecting functions
      • 5.5.8. Limitations
    • 5.6. Invoking GHCi
      • 5.6.1. Packages
      • 5.6.2. Extra libraries
    • 5.7. GHCi commands
    • 5.8. The :set and :seti commands
      • 5.8.1. GHCi options
      • 5.8.2. Setting GHC command-line options in GHCi
      • 5.8.3. Setting options for interactive evaluation only
    • 5.9. The .ghci and .haskeline files
      • 5.9.1. The .ghci files
      • 5.9.2. The .haskeline file
    • 5.10. Compiling to object code inside GHCi
    • 5.11. Running the interpreter in a separate process
    • 5.12. Running the interpreter on a different host
    • 5.13. FAQ and Things To Watch Out For
  • 6. Using runghc
    • 6.1. Usage
    • 6.2. runghc flags
    • 6.3. GHC Flags
  • 7. Using GHC
    • 7.1. Using GHC
      • 7.1.1. Getting started: compiling programs
      • 7.1.2. Options overview
        • 7.1.2.1. Command-line arguments
        • 7.1.2.2. Command line options in source files
        • 7.1.2.3. Setting options in GHCi
      • 7.1.3. Dynamic and Mode options
      • 7.1.4. Meaningful file suffixes
      • 7.1.5. Modes of operation
        • 7.1.5.1. Using ghc --make
        • 7.1.5.2. Expression evaluation mode
        • 7.1.5.3. Batch compiler mode
      • 7.1.6. Verbosity options
      • 7.1.7. Platform-specific Flags
      • 7.1.8. Miscellaneous flags
        • 7.1.8.1. Other environment variables
    • 7.2. Warnings and sanity-checking
    • 7.3. Optimisation (code improvement)
      • 7.3.1. -O*: convenient “packages” of optimisation flags.
      • 7.3.2. -f*: platform-independent flags
    • 7.4. Using Concurrent Haskell
    • 7.5. Using SMP parallelism
      • 7.5.1. Compile-time options for SMP parallelism
      • 7.5.2. RTS options for SMP parallelism
      • 7.5.3. Hints for 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.1.1. Setting RTS options on the command line
        • 7.7.1.2. Setting RTS options at compile time
        • 7.7.1.3. Setting RTS options with the GHCRTS environment variable
        • 7.7.1.4. “Hooks” to change RTS behaviour
      • 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. Options related to extended interface files
      • 7.8.9. The recompilation checker
      • 7.8.10. How to compile mutually recursive modules
      • 7.8.11. Module signatures
      • 7.8.12. Using make
      • 7.8.13. Dependency generation
      • 7.8.14. 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.5.1. The GHC_PACKAGE_PATH environment variable
        • 7.9.5.2. Package environments
      • 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.10.1. Native Code Generator (-fasm)
      • 7.10.2. LLVM Code Generator (-fllvm)
      • 7.10.3. C Code Generator (-fvia-C)
      • 7.10.4. Unregisterised compilation
    • 7.11. Options related to a particular phase
      • 7.11.1. Replacing the program for one or more phases
      • 7.11.2. Forcing options to a particular phase
      • 7.11.3. Options affecting the C pre-processor
        • 7.11.3.1. Standard CPP macros
        • 7.11.3.2. CPP and string gaps
      • 7.11.4. Options affecting a Haskell pre-processor
      • 7.11.5. Options affecting code generation
      • 7.11.6. Options affecting linking
    • 7.12. Using shared libraries
      • 7.12.1. Building programs that use shared libraries
      • 7.12.2. Shared libraries for Haskell packages
      • 7.12.3. Shared libraries that export a C API
      • 7.12.4. Finding shared libraries at runtime
        • 7.12.4.1. Unix
        • 7.12.4.2. Mac OS X
    • 7.13. Debugging the compiler
      • 7.13.1. Dumping out compiler intermediate structures
        • 7.13.1.1. Front-end
        • 7.13.1.2. Type-checking and renaming
        • 7.13.1.3. Core representation and simplification
        • 7.13.1.4. STG representation
        • 7.13.1.5. C-- representation
        • 7.13.1.6. LLVM code generator
        • 7.13.1.7. Native code generator
        • 7.13.1.8. Miscellaneous backend dumps
      • 7.13.2. Formatting dumps
      • 7.13.3. Suppressing unwanted information
      • 7.13.4. Checking for consistency
      • 7.13.5. Checking for determinism
      • 7.13.6. Other
  • 8. Profiling
    • 8.1. Cost centres and cost-centre stacks
      • 8.1.1. Inserting cost centres by hand
      • 8.1.2. Rules for attributing costs
    • 8.2. Compiler options for profiling
    • 8.3. Time and allocation profiling
      • 8.3.1. JSON profile format
    • 8.4. Profiling memory usage
      • 8.4.1. RTS options for heap profiling
      • 8.4.2. Retainer Profiling
        • 8.4.2.1. Hints for using retainer profiling
      • 8.4.3. Biographical Profiling
      • 8.4.4. Actual memory residency
    • 8.5. hp2ps – Rendering heap profiles to PostScript
      • 8.5.1. Manipulating the hp file
      • 8.5.2. Zooming in on regions of your profile
      • 8.5.3. Viewing the heap profile of a running program
      • 8.5.4. Viewing a heap profile in real time
    • 8.6. Profiling Parallel and Concurrent Programs
    • 8.7. Observing Code Coverage
      • 8.7.1. A small example: Reciprocation
      • 8.7.2. Options for instrumenting code for coverage
      • 8.7.3. The hpc toolkit
        • 8.7.3.1. hpc report
        • 8.7.3.2. hpc markup
        • 8.7.3.3. hpc sum
        • 8.7.3.4. hpc combine
        • 8.7.3.5. hpc map
        • 8.7.3.6. hpc overlay and hpc draft
      • 8.7.4. Caveats and Shortcomings of Haskell Program Coverage
    • 8.8. Using “ticky-ticky” profiling (for implementors)
  • 9. Advice on: sooner, faster, smaller, thriftier
    • 9.1. Sooner: producing a program more quickly
    • 9.2. Faster: producing a program that runs quicker
    • 9.3. Smaller: producing a program that is smaller
    • 9.4. Thriftier: producing a program that gobbles less heap space
  • 10. GHC Language Features
    • 10.1. Language options
    • 10.2. Unboxed types and primitive operations
      • 10.2.1. Unboxed types
      • 10.2.2. Unboxed type kinds
      • 10.2.3. Unboxed tuples
      • 10.2.4. Unboxed sums
      • 10.2.5. Unlifted Newtypes
    • 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.11.1. Recursive binding groups
        • 10.3.11.2. The mdo notation
      • 10.3.12. Applicative do-notation
        • 10.3.12.1. Strict patterns
        • 10.3.12.2. Things to watch out for
      • 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.17.1. Things unaffected by RebindableSyntax
      • 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.24.1. Hiding things the imported module doesn’t export
        • 10.3.24.2. Package-qualified imports
        • 10.3.24.3. Safe imports
        • 10.3.24.4. Explicit namespaces in import/export
        • 10.3.24.5. Writing qualified in postpositive position
      • 10.3.25. More liberal syntax for function arguments
        • 10.3.25.1. Changes to the grammar
      • 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.6.1. Why existential?
        • 10.4.6.2. Existentials and type classes
        • 10.4.6.3. Record Constructors
        • 10.4.6.4. Restrictions
      • 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.5.1. Traditional record syntax
      • 10.5.2. Record field disambiguation
      • 10.5.3. Duplicate record fields
        • 10.5.3.1. Selector functions
        • 10.5.3.2. Record updates
        • 10.5.3.3. Import and export of record fields
      • 10.5.4. Record puns
      • 10.5.5. Record wildcards
      • 10.5.6. Record field selector polymorphism
        • 10.5.6.1. Solving HasField constraints
        • 10.5.6.2. Virtual record fields
    • 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.4.1. Deriving Functor instances
        • 10.6.4.2. Deriving Foldable instances
        • 10.6.4.3. Deriving Traversable instances
        • 10.6.4.4. Deriving Data instances
        • 10.6.4.5. Deriving Typeable instances
        • 10.6.4.6. Deriving Lift instances
      • 10.6.5. Generalised derived instances for newtypes
        • 10.6.5.1. Generalising the deriving clause
        • 10.6.5.2. A more precise specification
        • 10.6.5.3. Associated type families
      • 10.6.6. Deriving any other class
      • 10.6.7. Deriving strategies
        • 10.6.7.1. Default deriving strategy
      • 10.6.8. Deriving via
    • 10.7. Pattern synonyms
      • 10.7.1. Record Pattern Synonyms
      • 10.7.2. Syntax and scoping of pattern synonyms
      • 10.7.3. Import and export of pattern synonyms
      • 10.7.4. Typing of pattern synonyms
      • 10.7.5. Matching of pattern synonyms
    • 10.8. Class and instances declarations
      • 10.8.1. Class declarations
        • 10.8.1.1. Multi-parameter type classes
        • 10.8.1.2. The superclasses of a class declaration
        • 10.8.1.3. Constrained class method types
        • 10.8.1.4. Default method signatures
        • 10.8.1.5. Nullary type classes
      • 10.8.2. Functional dependencies
        • 10.8.2.1. Rules for functional dependencies
        • 10.8.2.2. Background on functional dependencies
      • 10.8.3. Instance declarations
        • 10.8.3.1. Instance resolution
        • 10.8.3.2. Relaxed rules for the instance head
        • 10.8.3.3. Relaxed rules for instance contexts
        • 10.8.3.4. Instance termination rules
        • 10.8.3.5. Undecidable instances
        • 10.8.3.6. Overlapping instances
        • 10.8.3.7. Instance signatures: type signatures in instance declarations
      • 10.8.4. Overloaded string literals
      • 10.8.5. Overloaded labels
      • 10.8.6. Overloaded lists
        • 10.8.6.1. The IsList class
        • 10.8.6.2. Rebindable syntax
        • 10.8.6.3. Defaulting
        • 10.8.6.4. Speculation about the future
      • 10.8.7. Undecidable (or recursive) superclasses
    • 10.9. Type families
      • 10.9.1. Data families
        • 10.9.1.1. Data family declarations
        • 10.9.1.2. Data instance declarations
        • 10.9.1.3. Overlap of data instances
      • 10.9.2. Synonym families
        • 10.9.2.1. Type family declarations
        • 10.9.2.2. Type instance declarations
        • 10.9.2.3. Closed type families
        • 10.9.2.4. Type family examples
        • 10.9.2.5. Compatibility and apartness of type family equations
        • 10.9.2.6. Decidability of type synonym instances
      • 10.9.3. Wildcards on the LHS of data and type family instances
      • 10.9.4. Associated data and type families
        • 10.9.4.1. Associated instances
        • 10.9.4.2. Associated type synonym defaults
        • 10.9.4.3. Scoping of class parameters
        • 10.9.4.4. Instance contexts and associated type and data instances
      • 10.9.5. Import and export
        • 10.9.5.1. Examples
        • 10.9.5.2. Instances
      • 10.9.6. Type families and instance declarations
      • 10.9.7. Injective type families
        • 10.9.7.1. Syntax of injectivity annotation
        • 10.9.7.2. Verifying the injectivity annotation against type family equations
    • 10.10. Datatype promotion
      • 10.10.1. Motivation
      • 10.10.2. Overview
      • 10.10.3. Distinguishing between types and constructors
      • 10.10.4. Promoted list and tuple types
      • 10.10.5. Promoting existential data constructors
    • 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. Inferring the order of variables in a type/class declaration
      • 10.11.5. Complete user-supplied kind signatures and polymorphic recursion
      • 10.11.6. Standalone kind signatures and polymorphic recursion
      • 10.11.7. Standalone kind signatures and declaration headers
      • 10.11.8. Kind inference in closed type families
      • 10.11.9. Kind inference in class instance declarations
      • 10.11.10. Kind inference in type signatures
      • 10.11.11. Explicit kind quantification
      • 10.11.12. Implicit quantification in type synonyms and type family instances
      • 10.11.13. Kind-indexed GADTs
      • 10.11.14. Higher-rank kinds
      • 10.11.15. Constraints in kinds
      • 10.11.16. The kind Type
      • 10.11.17. Inferring dependency in datatype declarations
      • 10.11.18. Inferring dependency in user-written foralls
      • 10.11.19. Kind defaulting without PolyKinds
      • 10.11.20. Pretty-printing in the presence of kind polymorphism
    • 10.12. Levity polymorphism
      • 10.12.1. No levity-polymorphic variables or arguments
      • 10.12.2. Levity-polymorphic bottoms
      • 10.12.3. Printing levity-polymorphic types
    • 10.13. Type-Level Literals
      • 10.13.1. Runtime Values for Type-Level Literals
      • 10.13.2. Computing With Type-Level Naturals
    • 10.14. Equality constraints, Coercible, and the kind Constraint
      • 10.14.1. Equality constraints
      • 10.14.2. Heterogeneous equality
      • 10.14.3. Unlifted heterogeneous equality
      • 10.14.4. The Coercible constraint
      • 10.14.5. The Constraint kind
    • 10.15. Quantified constraints
      • 10.15.1. Motivation
      • 10.15.2. Syntax changes
      • 10.15.3. Typing changes
      • 10.15.4. Superclasses
      • 10.15.5. Overlap
      • 10.15.6. Instance lookup
      • 10.15.7. Termination
      • 10.15.8. Coherence
    • 10.16. Extensions to type signatures
      • 10.16.1. Explicit universal quantification (forall)
      • 10.16.2. The context of a type signature
      • 10.16.3. Ambiguous types and the ambiguity check
      • 10.16.4. Explicitly-kinded quantification
    • 10.17. Lexically scoped type variables
      • 10.17.1. Overview
      • 10.17.2. Declaration type signatures
      • 10.17.3. Expression type signatures
      • 10.17.4. Pattern type signatures
      • 10.17.5. Class and instance declarations
    • 10.18. Bindings and generalisation
      • 10.18.1. Switching off the dreaded Monomorphism Restriction
      • 10.18.2. Let-generalisation
    • 10.19. Visible type application
      • 10.19.1. Inferred vs. specified type variables
      • 10.19.2. Ordering of specified variables
    • 10.20. Implicit parameters
      • 10.20.1. Implicit-parameter type constraints
      • 10.20.2. Implicit-parameter bindings
      • 10.20.3. Implicit parameters and polymorphic recursion
      • 10.20.4. Implicit parameters and monomorphism
    • 10.21. Arbitrary-rank polymorphism
      • 10.21.1. Examples
      • 10.21.2. Type inference
      • 10.21.3. Implicit quantification
    • 10.22. Impredicative polymorphism
    • 10.23. Typed Holes
      • 10.23.1. Valid Hole Fits
        • 10.23.1.1. Refinement Hole Fits
        • 10.23.1.2. Sorting Valid Hole Fits
    • 10.24. Partial Type Signatures
      • 10.24.1. Syntax
        • 10.24.1.1. Type Wildcards
        • 10.24.1.2. Named Wildcards
        • 10.24.1.3. Extra-Constraints Wildcard
      • 10.24.2. Where can they occur?
    • 10.25. Custom compile-time errors
    • 10.26. Deferring type errors to runtime
      • 10.26.1. Enabling deferring of type errors
      • 10.26.2. Deferred type errors in GHCi
      • 10.26.3. Limitations of deferred type errors
    • 10.27. Template Haskell
      • 10.27.1. Syntax
      • 10.27.2. Using Template Haskell
      • 10.27.3. Viewing Template Haskell generated code
      • 10.27.4. A Template Haskell Worked Example
      • 10.27.5. Using Template Haskell with Profiling
      • 10.27.6. Template Haskell Quasi-quotation
    • 10.28. Arrow notation
      • 10.28.1. do-notation for commands
      • 10.28.2. Conditional commands
      • 10.28.3. Defining your own control structures
      • 10.28.4. Primitive constructs
      • 10.28.5. Differences with the paper
      • 10.28.6. Portability
    • 10.29. Bang patterns and Strict Haskell
      • 10.29.1. Bang patterns
      • 10.29.2. Strict-by-default data types
      • 10.29.3. Strict-by-default pattern bindings
      • 10.29.4. Modularity
      • 10.29.5. Dynamic semantics of bang patterns
    • 10.30. Assertions
    • 10.31. Static pointers
      • 10.31.1. Using static pointers
      • 10.31.2. Static semantics of 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 and DEPRECATED pragmas
      • 10.32.5. MINIMAL pragma
      • 10.32.6. INLINE and NOINLINE pragmas
        • 10.32.6.1. INLINE pragma
        • 10.32.6.2. INLINABLE pragma
        • 10.32.6.3. NOINLINE pragma
        • 10.32.6.4. CONLIKE modifier
        • 10.32.6.5. Phase control
      • 10.32.7. LINE pragma
      • 10.32.8. COLUMN pragma
      • 10.32.9. RULES pragma
      • 10.32.10. SPECIALIZE pragma
        • 10.32.10.1. SPECIALIZE INLINE
        • 10.32.10.2. SPECIALIZE for imported functions
      • 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. OVERLAPPING, OVERLAPPABLE, OVERLAPS, and INCOHERENT pragmas
    • 10.33. Rewrite rules
      • 10.33.1. Syntax
      • 10.33.2. Semantics
      • 10.33.3. How rules interact with INLINE/NOINLINE pragmas
      • 10.33.4. How rules interact with CONLIKE pragmas
      • 10.33.5. How rules interact with class methods
      • 10.33.6. List fusion
      • 10.33.7. Specialisation
      • 10.33.8. Controlling what’s going on in rewrite rules
    • 10.34. Special built-in functions
    • 10.35. Generic classes
    • 10.36. Generic programming
      • 10.36.1. Deriving representations
      • 10.36.2. Writing generic functions
      • 10.36.3. Unlifted representation types
      • 10.36.4. Generic defaults
      • 10.36.5. More information
    • 10.37. Roles
      • 10.37.1. Nominal, Representational, and Phantom
      • 10.37.2. Role inference
      • 10.37.3. Role annotations
    • 10.38. HasCallStack
      • 10.38.1. Compared with other sources of stack traces
    • 10.39. Concurrent and Parallel Haskell
      • 10.39.1. Concurrent Haskell
      • 10.39.2. Software Transactional Memory
      • 10.39.3. Parallel Haskell
      • 10.39.4. Annotating pure code for parallelism
    • 10.40. Safe Haskell
      • 10.40.1. Uses of Safe Haskell
        • 10.40.1.1. Strict type-safety (good style)
        • 10.40.1.2. Building secure systems (restricted IO Monads)
      • 10.40.2. Safe Language
        • 10.40.2.1. Safe Overlapping Instances
      • 10.40.3. Safe Imports
      • 10.40.4. Trust and Safe Haskell Modes
        • 10.40.4.1. Trust check (-fpackage-trust disabled)
        • 10.40.4.2. Trust check (-fpackage-trust enabled)
        • 10.40.4.3. Example
        • 10.40.4.4. Trustworthy Requirements
        • 10.40.4.5. Package Trust
      • 10.40.5. Safe Haskell Inference
      • 10.40.6. Safe Haskell Flag Summary
      • 10.40.7. Safe Compilation
  • 11. Foreign function interface (FFI)
    • 11.1. GHC differences to the FFI Chapter
      • 11.1.1. Guaranteed call safety
    • 11.2. GHC extensions to the FFI Chapter
      • 11.2.1. Unlifted FFI Types
      • 11.2.2. Newtype wrapping of the IO monad
      • 11.2.3. Explicit “forall”s in foreign types
      • 11.2.4. Primitive imports
      • 11.2.5. Interruptible foreign calls
      • 11.2.6. The CAPI calling convention
      • 11.2.7. hs_thread_done()
      • 11.2.8. Freeing many stable pointers efficiently
    • 11.3. Using the FFI with GHC
      • 11.3.1. Using foreign export and foreign import ccall "wrapper" with GHC
        • 11.3.1.1. Using your own main()
        • 11.3.1.2. Making a Haskell library that can be called from foreign code
      • 11.3.2. Using header files
      • 11.3.3. Memory Allocation
      • 11.3.4. Multi-threading and the FFI
        • 11.3.4.1. Foreign imports and multi-threading
        • 11.3.4.2. The relationship between Haskell threads and OS threads
        • 11.3.4.3. Foreign exports and multi-threading
        • 11.3.4.4. On the use of hs_exit()
        • 11.3.4.5. Waking up Haskell threads from C
      • 11.3.5. Floating point and the FFI
      • 11.3.6. Pinned Byte Arrays
  • 12. Extending and using GHC as a Library
    • 12.1. Source annotations
      • 12.1.1. Annotating values
      • 12.1.2. Annotating types
      • 12.1.3. Annotating modules
    • 12.2. Using GHC as a Library
    • 12.3. Compiler Plugins
      • 12.3.1. Using compiler plugins
      • 12.3.2. Writing compiler plugins
      • 12.3.3. Core plugins in more detail
        • 12.3.3.1. Manipulating bindings
        • 12.3.3.2. Using Annotations
      • 12.3.4. Typechecker plugins
        • 12.3.4.1. Constraint solving with plugins
      • 12.3.5. Source plugins
        • 12.3.5.1. Parsed representation
        • 12.3.5.2. Type checked representation
        • 12.3.5.3. Evaluated code
        • 12.3.5.4. Interface files
        • 12.3.5.5. Source plugin example
      • 12.3.6. Hole fit plugins
        • 12.3.6.1. Stateful hole fit plugins
        • 12.3.6.2. Hole fit plugin example
      • 12.3.7. Controlling Recompilation
      • 12.3.8. Frontend plugins
      • 12.3.9. DynFlags plugins
  • 13. What to do when something goes wrong
    • 13.1. When the compiler “does the wrong thing”
    • 13.2. When your program “does the wrong thing”
  • 14. Debugging compiled programs
    • 14.1. Tutorial
    • 14.2. Requesting a stack trace from Haskell code
    • 14.3. Requesting a stack trace with SIGQUIT
    • 14.4. Implementor’s notes: DWARF annotations
      • 14.4.1. Debugging information entities
        • 14.4.1.1. DW_TAG_ghc_src_note
    • 14.5. Further Reading
  • 15. Other Haskell utility programs
    • 15.1. “Yacc for Haskell”: happy
    • 15.2. Writing Haskell interfaces to C code: hsc2hs
      • 15.2.1. command line syntax
      • 15.2.2. Input syntax
      • 15.2.3. Custom constructs
      • 15.2.4. Cross-compilation
  • 16. Running GHC on Win32 systems
    • 16.1. Starting GHC on Windows platforms
    • 16.2. Running GHCi on Windows
    • 16.3. Interacting with the terminal
    • 16.4. Differences in library behaviour
    • 16.5. File paths under Windows
    • 16.6. Using GHC (and other GHC-compiled executables) with Cygwin
      • 16.6.1. Background
      • 16.6.2. The problem
      • 16.6.3. Things to do
    • 16.7. Building and using Win32 DLLs
      • 16.7.1. Creating a DLL
      • 16.7.2. Making DLLs to be called from other languages
        • 16.7.2.1. Using from VBA
        • 16.7.2.2. Using from C++
  • 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. Default Module headers with -main-is
        • 17.1.1.7. Module system and interface files
        • 17.1.1.8. Numbers, basic types, and built-in classes
        • 17.1.1.9. In Prelude support
        • 17.1.1.10. The Foreign Function Interface
        • 17.1.1.11. Operator sections
      • 17.1.2. GHC’s interpretation of undefined behaviour in Haskell 98 and Haskell 2010
    • 17.2. Known bugs or infelicities
      • 17.2.1. Bugs in GHC
      • 17.2.2. Bugs in GHCi (the interactive GHC)
  • 18. Eventlog encodings
    • 18.1. Event log format
    • 18.2. Runtime system diagnostics
      • 18.2.1. Capability sets
      • 18.2.2. Environment information
      • 18.2.3. Thread and scheduling events
      • 18.2.4. Garbage collector events
      • 18.2.5. Heap events and statistics
      • 18.2.6. Spark events
      • 18.2.7. Capability events
      • 18.2.8. Task events
      • 18.2.9. Tracing events
    • 18.3. Heap profiler event log output
      • 18.3.1. Metadata event types
        • 18.3.1.1. Beginning of sample stream
        • 18.3.1.2. Cost centre definitions
        • 18.3.1.3. Sample event types
        • 18.3.1.4. Cost-centre break-down
        • 18.3.1.5. String break-down
    • 18.4. Time profiler event log output
      • 18.4.1. Profile begin event
      • 18.4.2. Profile sample event
    • 18.5. Biographical profile sample event
    • 18.6. Non-moving GC event output
      • 18.6.1. Non-moving heap census
  • 19. Care and feeding of your GHC User’s Guide
    • 19.1. Basics
      • 19.1.1. Headings
      • 19.1.2. Formatting code
        • 19.1.2.1. Haskell
        • 19.1.2.2. Other languages
      • 19.1.3. Links
        • 19.1.3.1. Within the User’s Guide
        • 19.1.3.2. To GHC resources
        • 19.1.3.3. To external resources
        • 19.1.3.4. To core library Haddock documentation
        • 19.1.3.5. Math
      • 19.1.4. Index entries
    • 19.2. Citations
    • 19.3. Admonitions
    • 19.4. Documenting command-line options and GHCi commands
      • 19.4.1. Command-line options
      • 19.4.2. GHCi commands
    • 19.5. Style Conventions
    • 19.6. ReST reference materials

© 2002–2007 The University Court of the University of Glasgow. All rights reserved.
Licensed under the Glasgow Haskell Compiler License.
https://downloads.haskell.org/~ghc/8.10.2/docs/html/users_guide/index.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API