hs-mesos-0.20.1.0

Safe HaskellNone
LanguageHaskell2010

System.Mesos.Internal

Synopsis

Documentation

module Data.Word

module Foreign.C

runManaged :: Managed () -> IO ()

Run a Managed computation, enforcing that no acquired resources leak

data Managed a :: * -> *

A managed resource that you acquire using with

data ByteString :: *

A space-efficient representation of a Word8 vector, supporting many efficient operations.

A ByteString contains 8-bit bytes, or by using the operations from Data.ByteString.Char8 it can be interpreted as containing 8-bit characters.

Instances

Eq ByteString 
Data ByteString 
Ord ByteString 
Read ByteString 
Show ByteString 
IsString ByteString 
Monoid ByteString 
NFData ByteString 
Typeable * ByteString 
Strict ByteString ByteString 
HasFrameworkID FrameworkID ByteString 
HasOfferID OfferID ByteString 
HasSlaveID SlaveID ByteString 
HasTaskID TaskID ByteString 
HasExecutorID ExecutorID ByteString 
HasContainerID ContainerID ByteString 
HasUser FrameworkInfo ByteString 
HasPrincipal Credential ByteString 
HasName TaskInfo ByteString 
HasName Resource ByteString 
HasName FrameworkInfo ByteString 
HasID MasterInfo ByteString 
HasHostname Offer ByteString 
HasHostname SlaveInfo ByteString 
HasValue CommandURI ByteString 
HasContainerPath Volume ByteString 
HasImage ContainerType ByteString 
HasUser CommandInfo (Maybe ByteString) 
HasRole Resource (Maybe ByteString) 
HasRole FrameworkInfo (Maybe ByteString) 
HasPrincipal FrameworkInfo (Maybe ByteString) 
HasName ExecutorInfo (Maybe ByteString) 
HasHostname MasterInfo (Maybe ByteString) 
HasHostname FrameworkInfo (Maybe ByteString) 
HasCheckPath HealthCheckStrategy (Maybe ByteString) 
HasEnvironment CommandInfo (Maybe [(ByteString, ByteString)]) 
HasSource ExecutorInfo (Maybe ByteString) 
HasData TaskStatus (Maybe ByteString) 
HasData TaskInfo (Maybe ByteString) 
HasData ExecutorInfo (Maybe ByteString) 
HasPID MasterInfo (Maybe ByteString) 
HasAttributes Offer [(ByteString, Value)] 
HasAttributes SlaveInfo [(ByteString, Value)] 
HasUsageExecutorName ResourceUsage (Maybe ByteString) 
HasMessage TaskStatus (Maybe ByteString) 
HasSecret Credential (Maybe ByteString) 
HasHostPath Volume (Maybe ByteString) 

data Ptr a :: * -> *

A value of type Ptr a represents a pointer to an object, or an array of objects, which may be marshalled to or from Haskell values of type a.

The type a will often be an instance of class Storable which provides the marshalling operations. However this is not essential, and you can provide your own operations to access the pointer. For example you might write small foreign functions to get or set the fields of a C struct.

Instances

Eq (Ptr a) 
(Data a, Typeable * a) => Data (Ptr a) 
Ord (Ptr a) 
Show (Ptr a) 
Storable (Ptr a) 
Typeable (* -> *) Ptr 

data FunPtr a :: * -> *

A value of type FunPtr a is a pointer to a function callable from foreign code. The type a will normally be a foreign type, a function type with zero or more arguments where

A value of type FunPtr a may be a pointer to a foreign function, either returned by another foreign function or imported with a a static address import like

foreign import ccall "stdlib.h &free"
  p_free :: FunPtr (Ptr a -> IO ())

or a pointer to a Haskell function created using a wrapper stub declared to produce a FunPtr of the correct type. For example:

type Compare = Int -> Int -> Bool
foreign import ccall "wrapper"
  mkCompare :: Compare -> IO (FunPtr Compare)

Calls to wrapper stubs like mkCompare allocate storage, which should be released with freeHaskellFunPtr when no longer required.

To convert FunPtr values to corresponding Haskell functions, one can define a dynamic stub for the specific foreign type, e.g.

type IntFunction = CInt -> IO ()
foreign import ccall "dynamic" 
  mkFun :: FunPtr IntFunction -> IntFunction

Instances

Eq (FunPtr a) 
Ord (FunPtr a) 
Show (FunPtr a) 
Storable (FunPtr a) 
Typeable (* -> *) FunPtr 

nullPtr :: Ptr a

The constant nullPtr contains a distinguished value of Ptr that is not associated with a valid memory location.

peek :: Storable a => Ptr a -> Managed a Source

poke :: Storable a => Ptr a -> a -> Managed () Source

pokeMaybe :: Storable a => Ptr a -> Maybe a -> Managed () Source

arrayLen :: Storable a => [a] -> Managed (Ptr a, Int) Source

class Storable a

The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.

Memory addresses are represented as values of type Ptr a, for some a which is an instance of class Storable. The type argument to Ptr helps provide some valuable type safety in FFI code (you can't mix pointers of different types without an explicit cast), while helping the Haskell type system figure out which marshalling method is needed for a given pointer.

All marshalling between Haskell and a foreign language ultimately boils down to translating Haskell data structures into the binary representation of a corresponding data structure of the foreign language and vice versa. To code this marshalling in Haskell, it is necessary to manipulate primitive data types stored in unstructured memory blocks. The class Storable facilitates this manipulation on all types for which it is instantiated, which are the standard basic types of Haskell, the fixed size Int types (Int8, Int16, Int32, Int64), the fixed size Word types (Word8, Word16, Word32, Word64), StablePtr, all types from Foreign.C.Types, as well as Ptr.

Minimal complete definition: sizeOf, alignment, one of peek, peekElemOff and peekByteOff, and one of poke, pokeElemOff and pokeByteOff.

Minimal complete definition

sizeOf, alignment, (peek | peekElemOff | peekByteOff), (poke | pokeElemOff | pokeByteOff)

liftIO :: MonadIO m => forall a. IO a -> m a

Lift a computation from the IO monad.

type ToID a = Ptr CChar -> CInt -> IO a Source

type FromID a = a -> Ptr (Ptr CChar) -> IO CInt Source

defEq :: Eq a => a -> Maybe a -> Maybe a -> Bool Source