{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# OPTIONS_HADDOCK not-home #-}
module Data.Emacs.Module.Raw.Env.Internal
( Env(..)
, toPtr
, exportToEmacs
, RawFunctionType
, RawFunction(..)
) where
import Foreign
import Foreign.C.Types
import Data.Emacs.Module.NonNullPtr
import Data.Emacs.Module.Raw.Value
import Data.Emacs.Module.NonNullPtr.Internal
newtype Env = Env { unEnv :: NonNullPtr Env }
{-# INLINE toPtr #-}
toPtr :: Env -> Ptr Env
toPtr = unNonNullPtr . unEnv
type RawFunctionType a =
Env
-> CPtrdiff
-> Ptr RawValue
-> Ptr a
-> IO RawValue
foreign import ccall "wrapper"
exportToEmacs :: RawFunctionType a -> IO (RawFunction a)
newtype RawFunction a = RawFunction { unRawFunction :: FunPtr (RawFunctionType a) }