TcForeign

ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

TcForeign

Synopsis

- tcForeignImports :: [LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt)
- tcForeignExports :: [LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt)
- isForeignImport :: LForeignDecl name -> Bool
- isForeignExport :: LForeignDecl name -> Bool
- tcFImport :: LForeignDecl Name -> TcM (Id, LForeignDecl Id, Bag GlobalRdrElt)
- tcFExport :: ForeignDecl Name -> TcM (LHsBind Id, ForeignDecl Id, Bag GlobalRdrElt)
- tcForeignImports' :: [LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt)
- tcCheckFIType :: [Type] -> Type -> ForeignImport -> TcM ForeignImport
- checkCTarget :: CCallTarget -> TcM ()
- checkForeignArgs :: (Type -> Validity) -> [Type] -> TcM ()
- checkForeignRes :: Bool -> Bool -> (Type -> Validity) -> Type -> TcM ()
- normaliseFfiType :: Type -> TcM (Coercion, Type, Bag GlobalRdrElt)
- nonIOok :: Bool
- mustBeIO :: Bool
- checkSafe :: Bool
- noCheckSafe :: Bool
- tcForeignExports' :: [LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt)
- tcCheckFEType :: Type -> ForeignExport -> TcM ForeignExport

# Documentation

tcForeignImports :: [LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt) Source #

tcForeignExports :: [LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt) Source #

isForeignImport :: LForeignDecl name -> Bool Source #

isForeignExport :: LForeignDecl name -> Bool Source #

tcFImport :: LForeignDecl Name -> TcM (Id, LForeignDecl Id, Bag GlobalRdrElt) Source #

tcFExport :: ForeignDecl Name -> TcM (LHsBind Id, ForeignDecl Id, Bag GlobalRdrElt) Source #

tcForeignImports' :: [LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt) Source #

tcCheckFIType :: [Type] -> Type -> ForeignImport -> TcM ForeignImport Source #

checkCTarget :: CCallTarget -> TcM () Source #

checkForeignArgs :: (Type -> Validity) -> [Type] -> TcM () Source #

checkForeignRes :: Bool -> Bool -> (Type -> Validity) -> Type -> TcM () Source #

Check that the type has the form (IO t) or (t) , and that t satisfies the given predicate. When calling this function, any newtype wrappers (should) have been already dealt with by normaliseFfiType.

We also check that the Safe Haskell condition of FFI imports having results in the IO monad holds.

normaliseFfiType :: Type -> TcM (Coercion, Type, Bag GlobalRdrElt) Source #

nonIOok :: Bool Source #

mustBeIO :: Bool Source #

checkSafe :: Bool Source #

noCheckSafe :: Bool Source #

tcForeignExports' :: [LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt) Source #

tcCheckFEType :: Type -> ForeignExport -> TcM ForeignExport Source #