TcForeign

ghc-8.6.3: The GHC API

Safe Haskell | None
Language | Haskell2010

TcForeign

Synopsis

- tcForeignImports :: [LForeignDecl GhcRn] -> TcM ([Id], [LForeignDecl GhcTc], Bag GlobalRdrElt)
- tcForeignExports :: [LForeignDecl GhcRn] -> TcM (LHsBinds GhcTcId, [LForeignDecl GhcTcId], Bag GlobalRdrElt)
- isForeignImport :: LForeignDecl name -> Bool
- isForeignExport :: LForeignDecl name -> Bool
- tcFImport :: LForeignDecl GhcRn -> TcM (Id, LForeignDecl GhcTc, Bag GlobalRdrElt)
- tcFExport :: ForeignDecl GhcRn -> TcM (LHsBind GhcTc, ForeignDecl GhcTc, Bag GlobalRdrElt)
- tcForeignImports' :: [LForeignDecl GhcRn] -> TcM ([Id], [LForeignDecl GhcTc], 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 GhcRn] -> TcM (LHsBinds GhcTcId, [LForeignDecl GhcTcId], Bag GlobalRdrElt)
- tcCheckFEType :: Type -> ForeignExport -> TcM ForeignExport

# Documentation

tcForeignImports :: [LForeignDecl GhcRn] -> TcM ([Id], [LForeignDecl GhcTc], Bag GlobalRdrElt) #

tcForeignExports :: [LForeignDecl GhcRn] -> TcM (LHsBinds GhcTcId, [LForeignDecl GhcTcId], Bag GlobalRdrElt) #

isForeignImport :: LForeignDecl name -> Bool #

isForeignExport :: LForeignDecl name -> Bool #

tcFImport :: LForeignDecl GhcRn -> TcM (Id, LForeignDecl GhcTc, Bag GlobalRdrElt) #

tcFExport :: ForeignDecl GhcRn -> TcM (LHsBind GhcTc, ForeignDecl GhcTc, Bag GlobalRdrElt) #

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

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

checkCTarget :: CCallTarget -> TcM () #

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

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

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

nonIOok :: Bool #

mustBeIO :: Bool #

checkSafe :: Bool #

noCheckSafe :: Bool #

tcForeignExports' :: [LForeignDecl GhcRn] -> TcM (LHsBinds GhcTcId, [LForeignDecl GhcTcId], Bag GlobalRdrElt) #

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