ForeignCall

ghc-8.4.4: The GHC API

Safe Haskell | None
Language | Haskell2010

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 UnitId) 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

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

isSafeForeignCall :: ForeignCall -> Bool #

data Safety #

Constructors

PlaySafe |
PlayInterruptible |
PlayRisky |

Instances

Eq Safety # |
Instance details Defined in ForeignCall Methods (==) :: Safety -> Safety -> Bool # (/=) :: Safety -> Safety -> Bool #
Data Safety # |
Instance details Defined in ForeignCall Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Safety -> c Safety Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Safety Source # toConstr :: Safety -> Constr Source # dataTypeOf :: Safety -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Safety) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Safety) Source # gmapT :: (forall b. Data b => b -> b) -> Safety -> Safety Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Safety -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Safety -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Safety -> m Safety Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety Source #
Show Safety # |
Instance details Defined in ForeignCall Methods showsPrec :: Int -> Safety -> ShowS Source # show :: Safety -> String Source # showList :: [Safety] -> ShowS Source #
Outputable Safety # |
Instance details Defined in ForeignCall Methods ppr :: Safety -> SDoc # pprPrec :: Rational -> Safety -> SDoc #
Binary Safety # |
Instance details Defined in ForeignCall Methods put_ :: BinHandle -> Safety -> IO () # put :: BinHandle -> Safety -> IO (Bin Safety) # get :: BinHandle -> IO Safety #

playSafe :: Safety -> Bool #

playInterruptible :: Safety -> Bool #

data CExportSpec #

Constructors

CExportStatic SourceText CLabelString CCallConv |

Instances

Data CExportSpec # |
Instance details Defined in ForeignCall Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CExportSpec -> c CExportSpec Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CExportSpec Source # toConstr :: CExportSpec -> Constr Source # dataTypeOf :: CExportSpec -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CExportSpec) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CExportSpec) Source # gmapT :: (forall b. Data b => b -> b) -> CExportSpec -> CExportSpec Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CExportSpec -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CExportSpec -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CExportSpec -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CExportSpec -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec Source #
Outputable CExportSpec # |
Instance details Defined in ForeignCall Methods ppr :: CExportSpec -> SDoc # pprPrec :: Rational -> CExportSpec -> SDoc #
Binary CExportSpec # |
Instance details Defined in ForeignCall Methods put_ :: BinHandle -> CExportSpec -> IO () # put :: BinHandle -> CExportSpec -> IO (Bin CExportSpec) # get :: BinHandle -> IO CExportSpec #

type CLabelString = FastString #

isCLabelString :: CLabelString -> Bool #

pprCLabelString :: CLabelString -> SDoc #

data CCallSpec #

Constructors

CCallSpec CCallTarget CCallConv Safety |

Instances

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

data CCallTarget #

How to call a particular function in C-land.

Constructors

StaticTarget SourceText CLabelString (Maybe UnitId) Bool |
DynamicTarget |

Instances

Eq CCallTarget # |
Instance details Defined in ForeignCall Methods (==) :: CCallTarget -> CCallTarget -> Bool # (/=) :: CCallTarget -> CCallTarget -> Bool #
Data CCallTarget # |
Instance details Defined in ForeignCall Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CCallTarget -> c CCallTarget Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CCallTarget Source # toConstr :: CCallTarget -> Constr Source # dataTypeOf :: CCallTarget -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CCallTarget) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CCallTarget) Source # gmapT :: (forall b. Data b => b -> b) -> CCallTarget -> CCallTarget Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CCallTarget -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CCallTarget -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CCallTarget -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CCallTarget -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget Source #
Binary CCallTarget # |
Instance details Defined in ForeignCall Methods put_ :: BinHandle -> CCallTarget -> IO () # put :: BinHandle -> CCallTarget -> IO (Bin CCallTarget) # get :: BinHandle -> IO CCallTarget #

isDynamicTarget :: CCallTarget -> Bool #

data CCallConv #

Constructors

CCallConv |
CApiConv |
StdCallConv |
PrimCallConv |
JavaScriptCallConv |

Instances

Eq CCallConv # |
Instance details Defined in ForeignCall Methods (==) :: CCallConv -> CCallConv -> Bool # (/=) :: CCallConv -> CCallConv -> Bool #
Data CCallConv # |
Instance details Defined in ForeignCall Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CCallConv -> c CCallConv Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CCallConv Source # toConstr :: CCallConv -> Constr Source # dataTypeOf :: CCallConv -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CCallConv) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CCallConv) Source # gmapT :: (forall b. Data b => b -> b) -> CCallConv -> CCallConv Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CCallConv -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CCallConv -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CCallConv -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CCallConv -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv Source #
Outputable CCallConv # |
Instance details Defined in ForeignCall Methods ppr :: CCallConv -> SDoc # pprPrec :: Rational -> CCallConv -> SDoc #
Binary CCallConv # |
Instance details Defined in ForeignCall Methods put_ :: BinHandle -> CCallConv -> IO () # put :: BinHandle -> CCallConv -> IO (Bin CCallConv) # get :: BinHandle -> IO CCallConv #

defaultCCallConv :: CCallConv #

ccallConvToInt :: CCallConv -> Int #

ccallConvAttribute :: CCallConv -> SDoc #

data Header #

Constructors

Header SourceText FastString |

Instances

Eq Header # |
Instance details Defined in ForeignCall Methods (==) :: Header -> Header -> Bool # (/=) :: Header -> Header -> Bool #
Data Header # |
Instance details Defined in ForeignCall Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Header -> c Header Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Header Source # toConstr :: Header -> Constr Source # dataTypeOf :: Header -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Header) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Header) Source # gmapT :: (forall b. Data b => b -> b) -> Header -> Header Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Header -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Header -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Header -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Header -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Header -> m Header Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Header -> m Header Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Header -> m Header Source #
Outputable Header # |
Instance details Defined in ForeignCall Methods ppr :: Header -> SDoc # pprPrec :: Rational -> Header -> SDoc #
Binary Header # |
Instance details Defined in ForeignCall Methods put_ :: BinHandle -> Header -> IO () # put :: BinHandle -> Header -> IO (Bin Header) # get :: BinHandle -> IO Header #

data CType #

A C type, used in CAPI FFI calls

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

Constructors

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

Instances

Eq CType # |
Instance details Defined in ForeignCall Methods (==) :: CType -> CType -> Bool # (/=) :: CType -> CType -> Bool #
Data CType # |
Instance details Defined in ForeignCall Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CType -> c CType Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CType Source # toConstr :: CType -> Constr Source # dataTypeOf :: CType -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CType) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CType) Source # gmapT :: (forall b. Data b => b -> b) -> CType -> CType Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CType -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CType -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CType -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CType -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CType -> m CType Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CType -> m CType Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CType -> m CType Source #
Outputable CType # |
Instance details Defined in ForeignCall Methods ppr :: CType -> SDoc # pprPrec :: Rational -> CType -> SDoc #
Binary CType # |
Instance details Defined in ForeignCall Methods put_ :: BinHandle -> CType -> IO () # put :: BinHandle -> CType -> IO (Bin CType) # get :: BinHandle -> IO CType #