emacs-module-0.2: Utilities to write Emacs dynamic modules
Copyright(c) Sergey Vinokurov 2018
LicenseApache-2.0 (see LICENSE)
Maintainerserg.foo@gmail.com
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Emacs.Module.Value

Description

 
Synopsis

Documentation

data Value (s :: k) Source #

Value that is independent of environment (Env) that produced it. Incidentally, this implies that it's "protected" against Emacs GC and thus will not unexpectedly go out of scope.

In order to prevent memory leaks, value is registered in the Emacs monad than produced it and will be freed when the monad finishes. To make the connection clear the value is tagged with parameter s, which serves the same purpose as tag of the ST monad. That is, it ensures that value cannot leave the scope of the monad that produced it.

Instances

Instances details
MonadEmacs (EmacsM :: k -> Type -> TYPE LiftedRep) (Value :: k -> TYPE LiftedRep) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

makeGlobalRef :: forall (s :: k0). WithCallStack => Value s -> EmacsM s (RawValue 'Pinned) Source #

freeGlobalRef :: forall (s :: k0). WithCallStack => RawValue 'Pinned -> EmacsM s () Source #

nonLocalExitCheck :: forall (s :: k0). WithCallStack => EmacsM s (FuncallExit ()) Source #

nonLocalExitGet :: forall (s :: k0). WithCallStack => EmacsM s (FuncallExit (Value s, Value s)) Source #

nonLocalExitSignal :: forall f (s :: k0). (WithCallStack, Foldable f) => Value s -> f (Value s) -> EmacsM s () Source #

nonLocalExitThrow :: forall (s :: k0). WithCallStack => Value s -> Value s -> EmacsM s () Source #

nonLocalExitClear :: forall (s :: k0). WithCallStack => EmacsM s () Source #

makeFunction :: forall (req :: Nat) (opt :: Nat) (rest :: Bool) (s :: k0). (WithCallStack, EmacsInvocation req opt rest, GetArities req opt rest) => (forall (s' :: k0). EmacsFunction req opt rest EmacsM Value s') -> Doc -> EmacsM s (Value s) Source #

funcall :: forall f (s :: k0). (WithCallStack, Foldable f) => Value s -> f (Value s) -> EmacsM s (Value s) Source #

funcallPrimitive :: forall f (s :: k0). (WithCallStack, Foldable f) => Value s -> f (Value s) -> EmacsM s (Value s) Source #

funcallPrimitiveUnchecked :: forall f (s :: k0). (WithCallStack, Foldable f) => Value s -> f (Value s) -> EmacsM s (Value s) Source #

intern :: forall (s :: k0). WithCallStack => SymbolName -> EmacsM s (Value s) Source #

typeOf :: forall (s :: k0). WithCallStack => Value s -> EmacsM s (Value s) Source #

isNotNil :: forall (s :: k0). WithCallStack => Value s -> EmacsM s Bool Source #

eq :: forall (s :: k0). WithCallStack => Value s -> Value s -> EmacsM s Bool Source #

extractWideInteger :: forall (s :: k0). WithCallStack => Value s -> EmacsM s Int64 Source #

makeWideInteger :: forall (s :: k0). WithCallStack => Int64 -> EmacsM s (Value s) Source #

extractDouble :: forall (s :: k0). WithCallStack => Value s -> EmacsM s Double Source #

makeDouble :: forall (s :: k0). WithCallStack => Double -> EmacsM s (Value s) Source #

extractText :: forall (s :: k0). WithCallStack => Value s -> EmacsM s Text Source #

extractShortByteString :: forall (s :: k0). WithCallStack => Value s -> EmacsM s ShortByteString Source #

makeString :: forall (s :: k0). WithCallStack => ByteString -> EmacsM s (Value s) Source #

extractUserPtr :: forall (s :: k0) a. WithCallStack => Value s -> EmacsM s (Ptr a) Source #

makeUserPtr :: forall a (s :: k0). WithCallStack => FinalizerPtr a -> Ptr a -> EmacsM s (Value s) Source #

assignUserPtr :: forall (s :: k0) a. WithCallStack => Value s -> Ptr a -> EmacsM s () Source #

extractUserPtrFinaliser :: forall (s :: k0) a. WithCallStack => Value s -> EmacsM s (FinalizerPtr a) Source #

assignUserPtrFinaliser :: forall (s :: k0) a. WithCallStack => Value s -> FinalizerPtr a -> EmacsM s () Source #

vecGet :: forall (s :: k0). WithCallStack => Value s -> Int -> EmacsM s (Value s) Source #

unsafeVecGet :: forall (s :: k0). WithCallStack => Value s -> Int -> EmacsM s (Value s) Source #

vecSet :: forall (s :: k0). WithCallStack => Value s -> Int -> Value s -> EmacsM s () Source #

vecSize :: forall (s :: k0). WithCallStack => Value s -> EmacsM s Int Source #

processInput :: forall (s :: k0). WithCallStack => EmacsM s Result Source #

Vector Vector (Value s') Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

Methods

basicUnsafeFreeze :: Mutable Vector s (Value s') -> ST s (Vector (Value s')) #

basicUnsafeThaw :: Vector (Value s') -> ST s (Mutable Vector s (Value s')) #

basicLength :: Vector (Value s') -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (Value s') -> Vector (Value s') #

basicUnsafeIndexM :: Vector (Value s') -> Int -> Box (Value s') #

basicUnsafeCopy :: Mutable Vector s (Value s') -> Vector (Value s') -> ST s () #

elemseq :: Vector (Value s') -> Value s' -> b -> b #

MVector MVector (Value s') Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

Methods

basicLength :: MVector s (Value s') -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (Value s') -> MVector s (Value s') #

basicOverlaps :: MVector s (Value s') -> MVector s (Value s') -> Bool #

basicUnsafeNew :: Int -> ST s (MVector s (Value s')) #

basicInitialize :: MVector s (Value s') -> ST s () #

basicUnsafeReplicate :: Int -> Value s' -> ST s (MVector s (Value s')) #

basicUnsafeRead :: MVector s (Value s') -> Int -> ST s (Value s') #

basicUnsafeWrite :: MVector s (Value s') -> Int -> Value s' -> ST s () #

basicClear :: MVector s (Value s') -> ST s () #

basicSet :: MVector s (Value s') -> Value s' -> ST s () #

basicUnsafeCopy :: MVector s (Value s') -> MVector s (Value s') -> ST s () #

basicUnsafeMove :: MVector s (Value s') -> MVector s (Value s') -> ST s () #

basicUnsafeGrow :: MVector s (Value s') -> Int -> ST s (MVector s (Value s')) #

Generic (Value s) Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

Associated Types

type Rep (Value s) :: Type -> Type #

Methods

from :: Value s -> Rep (Value s) x #

to :: Rep (Value s) x -> Value s #

Show (Value s) Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

Methods

showsPrec :: Int -> Value s -> ShowS #

show :: Value s -> String #

showList :: [Value s] -> ShowS #

NFData (Value s) Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

Methods

rnf :: Value s -> () #

GetRawValue (Value s) Source # 
Instance details

Defined in Data.Emacs.Module.GetRawValue

Methods

getRawValue :: Value s -> RawValue 'Regular Source #

Pretty (Value s) Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

Methods

pretty :: Value s -> Doc ann #

prettyList :: [Value s] -> Doc ann #

Prim (Value s) Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

Methods

sizeOf# :: Value s -> Int# #

alignment# :: Value s -> Int# #

indexByteArray# :: ByteArray# -> Int# -> Value s #

readByteArray# :: MutableByteArray# s0 -> Int# -> State# s0 -> (# State# s0, Value s #) #

writeByteArray# :: MutableByteArray# s0 -> Int# -> Value s -> State# s0 -> State# s0 #

setByteArray# :: MutableByteArray# s0 -> Int# -> Int# -> Value s -> State# s0 -> State# s0 #

indexOffAddr# :: Addr# -> Int# -> Value s #

readOffAddr# :: Addr# -> Int# -> State# s0 -> (# State# s0, Value s #) #

writeOffAddr# :: Addr# -> Int# -> Value s -> State# s0 -> State# s0 #

setOffAddr# :: Addr# -> Int# -> Int# -> Value s -> State# s0 -> State# s0 #

Unbox (Value s') Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

newtype MVector s (Value s') Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

newtype MVector s (Value s') = MV_Value (MVector s (Value s'))
type Rep (Value s) Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

type Rep (Value s)
newtype Vector (Value s') Source # 
Instance details

Defined in Data.Emacs.Module.Value.Internal

newtype Vector (Value s') = V_Value (Vector (Value s'))