HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduleghc-10.0.0.20260917GHC2024

Language.Haskell.Syntax.Decls.Foreign

Abstract syntax of foreign function interface declarations.

  • 13 types

Foreign function interface declarations

0 declarations

Data-type

datadata ForeignDecl pass
#
Instances6Data, Outputable, ToHie, Anno

Record synonym

Foreign export types

0 declarations

Data-type

datadata ForeignExport pass
#

Specification of an externally exported entity in dependence on the calling convention

Constructors

Instances5Data, Outputable, ToHie

Specification

Foreign import types

0 declarations

Data-type

datadata ForeignImport pass
#

Specification Of an imported external entity in dependence on the calling convention

Constructors

  • CImport (XCImport pass) (XRec pass CCallConv) (XRec pass Safety) (Maybe (Header pass)) (CImportSpec pass)

    Import of a C entity

    • the two strings specifying a header file or library may be empty, which indicates the absence of a header or object specification (both are not used in the case of CWrapper and when CFunction has a dynamic target)

    • the calling convention is irrelevant for code generation in the case of CLabel, but is needed for pretty printing

    • Safety is irrelevant for CLabel and CWrapper

  • XForeignImport !(XXForeignImport pass)
Instances5Data, Outputable, ToHie

Specification

Sub-types

datadata CCallTarget pass
#

How to call a particular function in C-land.

Constructors

Instances6Eq, Data, NFData, Binary
datadata ForeignKind
#

Constructors

Instances6Enum, Eq, Data, Show, NFData, Binary
  • Enum ForeignKindDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Eq ForeignKindDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Data ForeignKindDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Show ForeignKindDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • NFData ForeignKindDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Binary ForeignKindDefined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
datadata Safety
#

Constructors

  • PlaySafe

    Might invoke Haskell GC, or do a call back, or switch threads, etc. So make sure things are tidy before the call. Additionally, in the threaded RTS we arrange for the external call to be executed by a separate OS thread, i.e., _concurrently_ to the execution of other Haskell threads.

  • PlayInterruptible

    Like PlaySafe, but additionally the worker thread running this foreign call may be unceremoniously killed, so it must be scheduled on an unbound thread.

  • PlayRisky

    None of the above can happen; the call will return without interacting with the runtime system at all. Specifically:

    • No GC

    • No call backs

    • No blocking

    • No precise exceptions

Instances8Enum, Eq, Data, Show, NFData, Outputable, …
  • Enum SafetyDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Eq SafetyDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Data SafetyDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Show SafetyDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • NFData SafetyDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Outputable SafetyDefined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
  • Binary SafetyDefined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
  • type Anno Safety = EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Hs.Decls · orphan

Foreign binding type

1 declaration
datadata CType pass
#

A C type, used in CAPI FFI calls

Constructors

Instances7Data, NFData, Outputable, Binary, Anno, …

General sub-types

3 declarations
datadata CCallConv
#
Instances8Enum, Eq, Data, Show, NFData, Outputable, …
  • Enum CCallConvDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Eq CCallConvDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Data CCallConvDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Show CCallConvDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • NFData CCallConvDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.Decls.Foreign
  • Outputable CCallConvDefined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
  • Binary CCallConvDefined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
  • type Anno CCallConv = EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Hs.Decls · orphan
datadata Header pass
#

Constructors

Instances7Eq, Data, NFData, Outputable, Binary, …
  • Eq (Header (GhcPass p))Defined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
  • Data (Header GhcPs)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphan
  • Data (Header GhcRn)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphan
  • Data (Header GhcTc)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphan
  • NFData (Header (GhcPass p))Defined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
  • Outputable (Header (GhcPass p))Defined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan
  • Binary (Header (GhcPass p))Defined in ghc-10.0.0.20260917 · GHC.Types.ForeignCall · orphan

Extension points

0 declarations

ForeignDecl

ForeignExport

ForeignImport

CCallTarget

CType

familytype family XCType x
#
Instances1XCType

Header