memory-0.15.0: memory and related abstraction stuff
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilitystable
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Data.ByteArray.Types

Description

 
Synopsis

Documentation

class ByteArrayAccess ba where Source #

Class to Access size properties and data of a ByteArray

Minimal complete definition

length, withByteArray

Methods

length :: ba -> Int Source #

Return the length in bytes of a bytearray

withByteArray :: ba -> (Ptr p -> IO a) -> IO a Source #

Allow to use using a pointer

copyByteArrayToPtr :: ba -> Ptr p -> IO () Source #

Copy the data of a bytearray to a ptr

Instances

Instances details
ByteArrayAccess String Source # 
Instance details

Defined in Data.ByteArray.Types

Methods

length :: String -> Int Source #

withByteArray :: String -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: String -> Ptr p -> IO () Source #

ByteArrayAccess ByteString Source # 
Instance details

Defined in Data.ByteArray.Types

ByteArrayAccess MemView Source # 
Instance details

Defined in Data.ByteArray.MemView

ByteArrayAccess ScrubbedBytes Source # 
Instance details

Defined in Data.ByteArray.ScrubbedBytes

ByteArrayAccess Bytes Source # 
Instance details

Defined in Data.ByteArray.Bytes

Methods

length :: Bytes -> Int Source #

withByteArray :: Bytes -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: Bytes -> Ptr p -> IO () Source #

PrimType ty => ByteArrayAccess (UArray ty) Source # 
Instance details

Defined in Data.ByteArray.Types

Methods

length :: UArray ty -> Int Source #

withByteArray :: UArray ty -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: UArray ty -> Ptr p -> IO () Source #

PrimType ty => ByteArrayAccess (Block ty) Source # 
Instance details

Defined in Data.ByteArray.Types

Methods

length :: Block ty -> Int Source #

withByteArray :: Block ty -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: Block ty -> Ptr p -> IO () Source #

ByteArrayAccess bytes => ByteArrayAccess (View bytes) Source # 
Instance details

Defined in Data.ByteArray.View

Methods

length :: View bytes -> Int Source #

withByteArray :: View bytes -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: View bytes -> Ptr p -> IO () Source #

(KnownNat n, PrimType ty, Countable ty n) => ByteArrayAccess (BlockN n ty) Source # 
Instance details

Defined in Data.ByteArray.Types

Methods

length :: BlockN n ty -> Int Source #

withByteArray :: BlockN n ty -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: BlockN n ty -> Ptr p -> IO () Source #

(ByteArrayAccess ba, KnownNat n) => ByteArrayAccess (SizedByteArray n ba) Source # 
Instance details

Defined in Data.ByteArray.Sized

Methods

length :: SizedByteArray n ba -> Int Source #

withByteArray :: SizedByteArray n ba -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: SizedByteArray n ba -> Ptr p -> IO () Source #

class (Eq ba, Ord ba, Monoid ba, ByteArrayAccess ba) => ByteArray ba where Source #

Class to allocate new ByteArray of specific size

Methods

allocRet Source #

Arguments

:: Int

number of bytes to allocate. i.e. might not match the size of the given type ba.

-> (Ptr p -> IO a) 
-> IO (a, ba) 

allocate n bytes and perform the given operation

Instances

Instances details
ByteArray ByteString Source # 
Instance details

Defined in Data.ByteArray.Types

Methods

allocRet :: Int -> (Ptr p -> IO a) -> IO (a, ByteString) Source #

ByteArray ScrubbedBytes Source # 
Instance details

Defined in Data.ByteArray.ScrubbedBytes

Methods

allocRet :: Int -> (Ptr p -> IO a) -> IO (a, ScrubbedBytes) Source #

ByteArray Bytes Source # 
Instance details

Defined in Data.ByteArray.Bytes

Methods

allocRet :: Int -> (Ptr p -> IO a) -> IO (a, Bytes) Source #

(Ord ty, PrimType ty) => ByteArray (UArray ty) Source # 
Instance details

Defined in Data.ByteArray.Types

Methods

allocRet :: Int -> (Ptr p -> IO a) -> IO (a, UArray ty) Source #

(Ord ty, PrimType ty) => ByteArray (Block ty) Source # 
Instance details

Defined in Data.ByteArray.Types

Methods

allocRet :: Int -> (Ptr p -> IO a) -> IO (a, Block ty) Source #