Copyright | © 2020 G. Eyaeb |
---|---|

License | BSD-3-Clause |

Maintainer | geyaeb@protonmail.com |

Stability | experimental |

Portability | POSIX |

Safe Haskell | None |

Language | Haskell2010 |

This module contains functions for decoding stream of bytestrings (coming, for example, from TCP connection) to your data type using binary and vice versa.

## Synopsis

- decodeStream :: (Binary a, MonadFail m) => SerialT m ByteString -> SerialT m a
- decodeStreamGet :: MonadFail m => Get a -> SerialT m ByteString -> SerialT m a
- encodeStream :: (Binary a, MonadFail m) => SerialT m a -> SerialT m ByteString
- encodeStreamPut :: MonadFail m => (a -> Put) -> SerialT m a -> SerialT m ByteString

# Documentation

decodeStream :: (Binary a, MonadFail m) => SerialT m ByteString -> SerialT m a Source #

Decode stream of bytestrings given that there exists instance of `Binary`

for target type. Bytestrings do not have to be aligned in any way.

decodeStreamGet :: MonadFail m => Get a -> SerialT m ByteString -> SerialT m a Source #

encodeStream :: (Binary a, MonadFail m) => SerialT m a -> SerialT m ByteString Source #

Encode stream of elements to bytestrings given that there exists instance of `Binary`

for source type. Resulting bytestrings are not guaranteed to be aligned in any way.

encodeStreamPut :: MonadFail m => (a -> Put) -> SerialT m a -> SerialT m ByteString Source #