sdp-0.2.1.1: Simple Data Processing
Copyright(c) Andrey Mulik 2019-2021
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilitynon-portable (GHC extensions)
Safe HaskellTrustworthy
LanguageHaskell2010

SDP.Unboxed

Description

SDP.Unboxed provide service class Unboxed, that needed for SDP.Prim.SBytes-based structures.

Synopsis

Unboxed

class Eq e => Unboxed e where Source #

Unboxed is a layer between untyped raw data and parameterized unboxed data structures. Also it prevents direct interaction with primitives.

Minimal complete definition

(sizeof# | sizeof), (!#), (!>#), writeByteArray#, newUnboxed

Methods

sizeof :: e -> Int -> Int Source #

sizeof e n returns the length (in bytes) of primitive, where n - count of elements, e - type parameter.

sizeof# :: e -> Int# -> Int# Source #

sizeof# is unboxed sizeof.

(!#) :: ByteArray# -> Int# -> e Source #

Unsafe ByteArray# reader with overloaded result type.

(!>#) :: MutableByteArray# s -> Int# -> State# s -> (# State# s, e #) Source #

Unsafe MutableByteArray# reader with overloaded result type.

writeByteArray# :: MutableByteArray# s -> Int# -> e -> State# s -> State# s Source #

Unsafe MutableByteArray# writer.

fillByteArray# :: MutableByteArray# s -> Int# -> e -> State# s -> State# s Source #

Procedure for filling the array with the default value (like calloc).

newUnboxed :: e -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

newUnboxed creates new MutableByteArray# of given count of elements. First argument used as type variable.

newUnboxed' :: e -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

newUnboxed' is version of newUnboxed, that use first argument as initial value. May fail when trying to write error or undefined.

copyUnboxed# :: e -> ByteArray# -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

copyUnboxed# e bytes# o1# mbytes# o2# n# unsafely writes elements from bytes# to mbytes#, where o1# and o2# - offsets (element count), n# - count of elements to copy.

copyUnboxedM# :: e -> MutableByteArray# s -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

copyUnboxedM# e msrc# o1# mbytes# o2# n# unsafely writes elements from msrc# to mbytes#, where o1# and o2# - offsets (element count), n# - count of elements to copy.

hashUnboxedWith :: e -> Int# -> Int# -> ByteArray# -> Int# -> Int# Source #

hashUnboxedWith e len bytes# salt returns bytes# FNV-1 hash, where off# and len# is offset and length (in elements).

Note: the standard definition of this function is written in Haskell using low-level functions, but this implementation mayn't be as efficient as the foreign procedure in the hashable package.

Instances

Instances details
Unboxed Bool Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Char Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Double Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Float Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Int Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Int8 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Int16 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Int32 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Int64 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Word Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Word8 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Word16 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Word32 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed Word64 Source # 
Instance details

Defined in SDP.Unboxed

Unboxed () Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CChar Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CSChar Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CShort Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CUShort Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CInt Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CUInt Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CLong Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CULong Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CLLong Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CULLong Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CBool Source #

@since base-4.10.0.0

Instance details

Defined in SDP.Unboxed

Unboxed CFloat Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CDouble Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CPtrdiff Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CSize Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CWchar Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CSigAtomic Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CClock Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CTime Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CUSeconds Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CSUSeconds Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CIntPtr Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CUIntPtr Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CIntMax Source # 
Instance details

Defined in SDP.Unboxed

Unboxed CUIntMax Source # 
Instance details

Defined in SDP.Unboxed

Unboxed E Source # 
Instance details

Defined in SDP.Unboxed

Unboxed IntAs64 Source # 
Instance details

Defined in SDP.Unboxed.IntAs

Unboxed IntAs32 Source # 
Instance details

Defined in SDP.Unboxed.IntAs

Unboxed IntAs16 Source # 
Instance details

Defined in SDP.Unboxed.IntAs

Unboxed IntAs8 Source # 
Instance details

Defined in SDP.Unboxed.IntAs

Unboxed WordAs64 Source # 
Instance details

Defined in SDP.Unboxed.WordAs

Unboxed WordAs32 Source # 
Instance details

Defined in SDP.Unboxed.WordAs

Unboxed WordAs16 Source # 
Instance details

Defined in SDP.Unboxed.WordAs

Unboxed WordAs8 Source # 
Instance details

Defined in SDP.Unboxed.WordAs

(Unboxed a, Integral a) => Unboxed (Ratio a) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed (StablePtr a) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed (Ptr a) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed (FunPtr a) Source # 
Instance details

Defined in SDP.Unboxed

(Unboxed a, Num a) => Unboxed (Complex a) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (I1 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T15 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T14 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T13 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T12 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T11 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T10 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T9 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T8 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T7 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T6 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T5 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T4 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T3 e) Source # 
Instance details

Defined in SDP.Unboxed

Unboxed e => Unboxed (T2 e) Source # 
Instance details

Defined in SDP.Unboxed

(Enum e, Shape e, Bounded e, Unboxed e, Shape (e' :& e), Unboxed (e' :& e)) => Unboxed ((e' :& e) :& e) Source # 
Instance details

Defined in SDP.Unboxed

Methods

sizeof :: ((e' :& e) :& e) -> Int -> Int Source #

sizeof# :: ((e' :& e) :& e) -> Int# -> Int# Source #

(!#) :: ByteArray# -> Int# -> (e' :& e) :& e Source #

(!>#) :: MutableByteArray# s -> Int# -> State# s -> (# State# s, (e' :& e) :& e #) Source #

writeByteArray# :: MutableByteArray# s -> Int# -> ((e' :& e) :& e) -> State# s -> State# s Source #

fillByteArray# :: MutableByteArray# s -> Int# -> ((e' :& e) :& e) -> State# s -> State# s Source #

newUnboxed :: ((e' :& e) :& e) -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

newUnboxed' :: ((e' :& e) :& e) -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

copyUnboxed# :: ((e' :& e) :& e) -> ByteArray# -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

copyUnboxedM# :: ((e' :& e) :& e) -> MutableByteArray# s -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

hashUnboxedWith :: ((e' :& e) :& e) -> Int# -> Int# -> ByteArray# -> Int# -> Int# Source #

cloneUnboxed# :: Unboxed e => e -> ByteArray# -> Int# -> Int# -> ByteArray# Source #

cloneUnboxed o creates new c#-element length immutable slice of bytes# beginning from o#-th element.

Since: 0.2

cloneUnboxedM# :: Unboxed e => e -> MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

cloneUnboxedM o creates new c#-element length mutable slice of bytes# beginning from o#-th element.

Since: 0.2.1

thawUnboxed# :: Unboxed e => e -> ByteArray# -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

thawUnboxed# e bytes creates new sizeof bytes length MutableByteArray# and copy bytes# to it.

Since: 0.2.1

freezeUnboxed# :: Unboxed e => e -> MutableByteArray# s -> Int# -> State# s -> (# State# s, ByteArray# #) Source #

freezeUnboxed# e mbytes creates new sizeof bytes length ByteArray# and copy mbytes# to it.

Since: 0.2.1

Kind (Type -> Type) proxies

fromProxy :: proxy e -> e Source #

Returns undefined of suitable type.

psizeof# :: Unboxed e => proxy e -> Int# -> Int# Source #

psizeof# is proxy version of sizeof#.

Since: 0.2.1

psizeof :: Unboxed e => proxy e -> Int -> Int Source #

psizeof is proxy version of sizeof.

Since: 0.2

pnewUnboxed :: Unboxed e => proxy e -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

Kind (Type -> Type) proxy version of newUnboxed.

Since: 0.2

pcopyUnboxed :: Unboxed e => proxy e -> ByteArray# -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

Kind (Type -> Type) proxy version if copyUnboxed#.

Since: 0.2

pcopyUnboxedM :: Unboxed e => proxy e -> MutableByteArray# s -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

Kind (Type -> Type) proxy version if copyUnboxedM#.

Since: 0.2

pcloneUnboxed :: Unboxed e => proxy e -> ByteArray# -> Int# -> Int# -> ByteArray# Source #

Same as sdp-0.2 cloneUnboxed1#. Use only if you don't need sdp-0.2 compatibility.

Since: 0.2.1

pcloneUnboxedM :: Unboxed e => proxy e -> MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

Kind (Type -> Type) proxy version of cloneUnboxed#.

Since: 0.2.1

pthawUnboxed :: Unboxed e => proxy e -> ByteArray# -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

Kind (Type -> Type) proxy version of thawUnboxed#.

Since: 0.2.1

pfreezeUnboxed :: Unboxed e => proxy e -> MutableByteArray# s -> Int# -> State# s -> (# State# s, ByteArray# #) Source #

Kind (Type -> Type) proxy version of pfreezeUnboxed.

Since: 0.2.1

Kind (Type -> Type -> Type) proxies

fromProxy1 :: m (proxy e) -> e Source #

Returns undefined of suitable type.

pnewUnboxed1 :: Unboxed e => p (proxy e) -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

Kind (Type -> Type -> Type) proxy version of newUnboxed.

Since: 0.2

pcloneUnboxed1 :: Unboxed e => p (proxy e) -> ByteArray# -> Int# -> Int# -> ByteArray# Source #

Kind (Type -> Type -> Type) proxy version of cloneUnboxed#.

Since: 0.2.1

pcopyUnboxed1 :: Unboxed e => p (proxy e) -> ByteArray# -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

Kind (Type -> Type -> Type) proxy version of copyUnboxed#.

Since: 0.2

pcopyUnboxedM1 :: Unboxed e => p (proxy e) -> MutableByteArray# s -> Int# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s Source #

Kind (Type -> Type -> Type) proxy version of copyUnboxedM#.

Since: 0.2.1

cloneUnboxed1# :: Unboxed e => proxy e -> ByteArray# -> Int# -> Int# -> ByteArray# Source #

Kind (Type -> Type) proxy version of cloneUnboxed#.

Since: 0.2

pcloneUnboxedM1 :: Unboxed e => p (proxy e) -> MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, MutableByteArray# s #) Source #

Kind (Type -> Type -> Type) proxy version of cloneUnboxed#.

Since: 0.2.1

data Wrap Source #

ByteArray# wrapper.

Constructors

Wrap 

Fields

lzero# :: Wrap Source #

Wrapped empty ByteArray#.

Since: 0.2.1

single# :: Unboxed e => e -> ByteArray# Source #

ByteArray# singleton.

Since: 0.2.1

fromList# :: Unboxed e => [e] -> ByteArray# Source #

Create immutable Unboxed array from given list.

Since: 0.2.1

fromFoldable# :: (Foldable f, Unboxed e) => f e -> (# Int, ByteArray# #) Source #

Create immutable Unboxed array from Foldable stream.

Since: 0.2.1

fromListN# :: Unboxed e => Int# -> [e] -> ByteArray# Source #

Create immutable Unboxed array from known size list.

Since: 0.2.1

newLinear# :: Unboxed e => [e] -> State# s -> (# State# s, MutableByteArray# s #) Source #

Create mutable Unboxed array from given list.

Since: 0.2.1

newLinearN# :: Unboxed e => Int# -> [e] -> State# s -> (# State# s, MutableByteArray# s #) Source #

Create mutable Unboxed array from known size list.

Since: 0.2.1

fromFoldableM# :: (Foldable f, Unboxed e) => f e -> State# s -> (# State# s, Int, MutableByteArray# s #) Source #

Create mutable Unboxed array from Foldable stream.

Since: 0.2.1

concat# :: Unboxed e => e -> ByteArray# -> Int# -> Int# -> ByteArray# -> Int# -> Int# -> State# s -> (# State# s, Int#, MutableByteArray# s #) Source #

Concatenation of two Unboxed arrays.

Since: 0.2.1

pconcat :: Unboxed e => proxy e -> ByteArray# -> Int# -> Int# -> ByteArray# -> Int# -> Int# -> State# s -> (# State# s, Int#, MutableByteArray# s #) Source #

Proxy concatenation of two byte arrays representing Unboxed structures.