haste-compiler-0.4: Haskell To ECMAScript compiler

Safe HaskellNone



Handling of Javascript-native binary blobs.



type Put = PutM ()Source

skip :: Int -> Get ()Source

Skip n bytes of input.

class Monad m => MonadBlob m whereSource


getBlobData :: Blob -> m BlobDataSource

Retrieve the raw data from a blob.

getBlobText' :: Blob -> m JSStringSource

Interpret a blob as UTF-8 text, as a JSString.

class Binary a whereSource

Somewhat efficient serializationdeserialization tofrom binary Blobs. The layout of the binaries producedread by getput and encode/decode may change between versions. If you need a stable binary format, you should make your own using the primitives in Haste.Binary.Get/Put.


get :: Get aSource

put :: a -> PutSource

getBlobText :: MonadBlob m => Blob -> m StringSource

Interpret a blob as UTF-8 text.

blobSize :: Blob -> IntSource

The size, in bytes, of the contents of the given blob.

blobDataSize :: BlobData -> IntSource

The size, in bytes, of the contents of the given blob data.

toByteString :: BlobData -> ByteStringSource

Convert a BlobData to a ByteString. Only usable server-side.

toBlob :: BlobData -> BlobSource

Convert a piece of BlobData back into a Blob.

strToBlob :: JSString -> BlobSource

Create a Blob from a JSString.

encode :: Binary a => a -> BlobSource