hcobs: An implementation of the Consistent Overhead Byte Stuffing algorithm

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

An implementation of the Consistent Overhead Byte Stuffing algorithm.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.0, 0.1.0.1
Change log None available
Dependencies base (>=4.7 && <5), bytestring, containers, ghc-prim, reflection [details]
License BSD-3-Clause
Copyright 2017 Dario Bertini
Author Dario Bertini
Maintainer berdario@gmail.com
Category Codec
Home page https://github.com/berdario/hcobs#readme
Source repo head: git clone https://github.com/berdario/hcobs
Uploaded by berdario at 2018-11-18T13:16:32Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hcobs-0.1.0.0

[back to package description]

hcobs

Build Status

Haskell implementation of the Consistent Overhead Byte Stuffing algorithm.

It provides a Stuffed newtype wrapper for Lazy Bytestrings, which is parametrized on the Byte (Word8, representated as a type-level Nat) to be encoded away.

The implementation tries to be as efficient as possible, type safe and easy to use. If you have a "sink" like

sink :: Stuffed 0 -> IO ()
sink = undefined

You'd then simply be able to encode a Bytestring with sink $ stuff bytes.

You can try this out in ghci with:

> :set -XOverloadedStrings
> :set -XDataKinds
> import Data.Stuffed
> let stuffedBytes = stuff "a\0b\0c" :: Stuffed 0
> unpack $ unwrap stuffedBytes -- directly access the underlying bytestring
[2,97,2,98,2,99]
> unpack $ unstuff stuffedBytes
[97,0,98,0,99]