ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.ForeignCall

Synopsis

- newtype ForeignCall = CCall CCallSpec
- isSafeForeignCall :: ForeignCall -> Bool
- data Safety
  - = PlaySafe
  - | PlayInterruptible
  - | PlayRisky
- playSafe :: Safety -> Bool
- playInterruptible :: Safety -> Bool
- data CExportSpec = CExportStatic SourceText CLabelString CCallConv
- type CLabelString = FastString
- isCLabelString :: CLabelString -> Bool
- pprCLabelString :: CLabelString -> SDoc
- data CCallSpec = CCallSpec CCallTarget CCallConv Safety
- data CCallTarget
  - = StaticTarget SourceText CLabelString (Maybe Unit) Bool
  - | DynamicTarget
- isDynamicTarget :: CCallTarget -> Bool
- data CCallConv
  - = CCallConv
  - | CApiConv
  - | StdCallConv
  - | PrimCallConv
  - | JavaScriptCallConv
- defaultCCallConv :: CCallConv
- ccallConvToInt :: CCallConv -> Int
- ccallConvAttribute :: CCallConv -> SDoc
- data Header = Header SourceText FastString
- data CType = CType SourceText (Maybe Header) (SourceText, FastString)

# Documentation

newtype ForeignCall #

Constructors

CCall CCallSpec |

#### Instances

Instances details

Binary ForeignCall # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> ForeignCall -> IO () # put :: BinHandle -> ForeignCall -> IO (Bin ForeignCall) # get :: BinHandle -> IO ForeignCall #
Outputable ForeignCall # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: ForeignCall -> SDoc #
Eq ForeignCall # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: ForeignCall -> ForeignCall -> Bool # (/=) :: ForeignCall -> ForeignCall -> Bool #

isSafeForeignCall :: ForeignCall -> Bool #

data 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

#### Instances

Instances details

Data Safety # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Safety -> c Safety #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Safety #

toConstr :: Safety -> Constr #

dataTypeOf :: Safety -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Safety) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Safety) #

gmapT :: (forall b. Data b => b -> b) -> Safety -> Safety #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r #

gmapQ :: (forall d. Data d => d -> u) -> Safety -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Safety -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Safety -> m Safety #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety #

Enum Safety # |
Instance details Defined in GHC.Types.ForeignCall Methods succ :: Safety -> Safety # pred :: Safety -> Safety # toEnum :: Int -> Safety # fromEnum :: Safety -> Int # enumFrom :: Safety -> [Safety] # enumFromThen :: Safety -> Safety -> [Safety] # enumFromTo :: Safety -> Safety -> [Safety] # enumFromThenTo :: Safety -> Safety -> Safety -> [Safety] #
Show Safety # |
Instance details Defined in GHC.Types.ForeignCall Methods showsPrec :: Int -> Safety -> ShowS # show :: Safety -> String # showList :: [Safety] -> ShowS #
Binary Safety # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> Safety -> IO () # put :: BinHandle -> Safety -> IO (Bin Safety) # get :: BinHandle -> IO Safety #
Outputable Safety # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: Safety -> SDoc #
Eq Safety # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: Safety -> Safety -> Bool # (/=) :: Safety -> Safety -> Bool #
type Anno Safety # |
Instance details Defined in GHC.Hs.Decls type Anno Safety = EpaLocation

playSafe :: Safety -> Bool #

playInterruptible :: Safety -> Bool #

data CExportSpec #

Constructors

CExportStatic SourceText CLabelString CCallConv |

#### Instances

Instances details

Data CExportSpec # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CExportSpec -> c CExportSpec #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CExportSpec #

toConstr :: CExportSpec -> Constr #

dataTypeOf :: CExportSpec -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CExportSpec) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CExportSpec) #

gmapT :: (forall b. Data b => b -> b) -> CExportSpec -> CExportSpec #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CExportSpec -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CExportSpec -> r #

gmapQ :: (forall d. Data d => d -> u) -> CExportSpec -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CExportSpec -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec #

Binary CExportSpec # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> CExportSpec -> IO () # put :: BinHandle -> CExportSpec -> IO (Bin CExportSpec) # get :: BinHandle -> IO CExportSpec #
Outputable CExportSpec # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CExportSpec -> SDoc #
type Anno CExportSpec # |
Instance details Defined in GHC.Hs.Decls type Anno CExportSpec = EpaLocation

type CLabelString = FastString #

isCLabelString :: CLabelString -> Bool #

pprCLabelString :: CLabelString -> SDoc #

data CCallSpec #

Constructors

CCallSpec CCallTarget CCallConv Safety |

#### Instances

Instances details

Binary CCallSpec # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> CCallSpec -> IO () # put :: BinHandle -> CCallSpec -> IO (Bin CCallSpec) # get :: BinHandle -> IO CCallSpec #
Outputable CCallSpec # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CCallSpec -> SDoc #
Eq CCallSpec # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CCallSpec -> CCallSpec -> Bool # (/=) :: CCallSpec -> CCallSpec -> Bool #

data CCallTarget #

How to call a particular function in C-land.

Constructors

StaticTarget SourceText CLabelString (Maybe Unit) Bool |
DynamicTarget |

#### Instances

Instances details

Data CCallTarget # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CCallTarget -> c CCallTarget #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CCallTarget #

toConstr :: CCallTarget -> Constr #

dataTypeOf :: CCallTarget -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CCallTarget) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CCallTarget) #

gmapT :: (forall b. Data b => b -> b) -> CCallTarget -> CCallTarget #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CCallTarget -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CCallTarget -> r #

gmapQ :: (forall d. Data d => d -> u) -> CCallTarget -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CCallTarget -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget #

Binary CCallTarget # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> CCallTarget -> IO () # put :: BinHandle -> CCallTarget -> IO (Bin CCallTarget) # get :: BinHandle -> IO CCallTarget #
Eq CCallTarget # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CCallTarget -> CCallTarget -> Bool # (/=) :: CCallTarget -> CCallTarget -> Bool #

isDynamicTarget :: CCallTarget -> Bool #

data CCallConv #

Constructors

CCallConv |
CApiConv |
StdCallConv |
PrimCallConv |
JavaScriptCallConv |

#### Instances

Instances details

Data CCallConv # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CCallConv -> c CCallConv #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CCallConv #

toConstr :: CCallConv -> Constr #

dataTypeOf :: CCallConv -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CCallConv) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CCallConv) #

gmapT :: (forall b. Data b => b -> b) -> CCallConv -> CCallConv #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CCallConv -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CCallConv -> r #

gmapQ :: (forall d. Data d => d -> u) -> CCallConv -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CCallConv -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv #

Enum CCallConv # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

succ :: CCallConv -> CCallConv #

pred :: CCallConv -> CCallConv #

toEnum :: Int -> CCallConv #

fromEnum :: CCallConv -> Int #

enumFrom :: CCallConv -> [CCallConv] #

enumFromThen :: CCallConv -> CCallConv -> [CCallConv] #

enumFromTo :: CCallConv -> CCallConv -> [CCallConv] #

enumFromThenTo :: CCallConv -> CCallConv -> CCallConv -> [CCallConv] #

Binary CCallConv # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> CCallConv -> IO () # put :: BinHandle -> CCallConv -> IO (Bin CCallConv) # get :: BinHandle -> IO CCallConv #
Outputable CCallConv # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CCallConv -> SDoc #
Eq CCallConv # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CCallConv -> CCallConv -> Bool # (/=) :: CCallConv -> CCallConv -> Bool #
type Anno CCallConv # |
Instance details Defined in GHC.Hs.Decls type Anno CCallConv = EpaLocation

defaultCCallConv :: CCallConv #

ccallConvToInt :: CCallConv -> Int #

ccallConvAttribute :: CCallConv -> SDoc #

data Header #

Constructors

Header SourceText FastString |

#### Instances

Instances details

Data Header # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Header -> c Header #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Header #

toConstr :: Header -> Constr #

dataTypeOf :: Header -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Header) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Header) #

gmapT :: (forall b. Data b => b -> b) -> Header -> Header #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Header -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Header -> r #

gmapQ :: (forall d. Data d => d -> u) -> Header -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Header -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Header -> m Header #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Header -> m Header #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Header -> m Header #

Binary Header # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> Header -> IO () # put :: BinHandle -> Header -> IO (Bin Header) # get :: BinHandle -> IO Header #
Outputable Header # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: Header -> SDoc #
Eq Header # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: Header -> Header -> Bool # (/=) :: Header -> Header -> Bool #

data CType #

A C type, used in CAPI FFI calls

- `AnnKeywordId` : `AnnOpen` `'{-# CTYPE'`, `AnnHeader`,`AnnVal`, `AnnClose` `'#-}'`,

Constructors

CType SourceText (Maybe Header) (SourceText, FastString) |

#### Instances

Instances details

Data CType # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CType -> c CType #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CType #

toConstr :: CType -> Constr #

dataTypeOf :: CType -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CType) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CType) #

gmapT :: (forall b. Data b => b -> b) -> CType -> CType #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CType -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CType -> r #

gmapQ :: (forall d. Data d => d -> u) -> CType -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CType -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CType -> m CType #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CType -> m CType #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CType -> m CType #

Binary CType # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: BinHandle -> CType -> IO () # put :: BinHandle -> CType -> IO (Bin CType) # get :: BinHandle -> IO CType #
Outputable CType # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CType -> SDoc #
Eq CType # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CType -> CType -> Bool # (/=) :: CType -> CType -> Bool #
type Anno CType # |
Instance details Defined in GHC.Hs.Decls type Anno CType = SrcSpanAnnP