{-# 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 { Env -> NonNullPtr Env
unEnv :: NonNullPtr Env }
{-# INLINE toPtr #-}
toPtr :: Env -> Ptr Env
toPtr :: Env -> Ptr Env
toPtr = NonNullPtr Env -> Ptr Env
forall a. NonNullPtr a -> Ptr a
unNonNullPtr (NonNullPtr Env -> Ptr Env)
-> (Env -> NonNullPtr Env) -> Env -> Ptr Env
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> NonNullPtr Env
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 { RawFunction a -> FunPtr (RawFunctionType a)
unRawFunction :: FunPtr (RawFunctionType a) }