fountain-0.1: A fountain codec.

Safe HaskellSafe-Inferred




Fountain codes are forward error correction codes for erasure channels. They are able to recover lost packets without needing a backchannel. As a rateless code, transmitters generate packets at random, on the fly. Receivers then listen to as many packets as needed to reconstruct the message.



data Droplet a Source

A message droplet is a set of message indices and the combined symbol.


Droplet IntSet a 


Eq a => Eq (Droplet a) 
Show a => Show (Droplet a) 

data Decoder a Source

A decoder holds the state of the decoding process.

type Precoding = [IntSet]Source

A precoding matrix that appends extra symbols to a message.


precoding :: Int -> Int -> Int -> (Int, Int) -> PrecodingSource

Generates a random precoding matrix.

 precoding seed messageLength extraSymbols boundaries

droplets :: (Num a, Bits a) => Int -> Int -> Precoding -> [a] -> [Droplet a]Source

An infinite list of droplets, given a seed, the max degree, precoding, and a message.

decoder :: (Num a, Bits a) => Int -> Precoding -> Decoder aSource

Creates a new decoder given a message length and the precoding.

decode :: (Num a, Bits a) => Decoder a -> Droplet a -> (Decoder a, Maybe [a])Source

Given a Decoder and a new Droplet, returns either an updated Decoder or the decoded message.


test :: Int -> Int -> Precoding -> Int -> (Int, Bool, [Decoder Word8])Source

Runs a test of a [Word8] message given the message length, max droplet degree, and a seed. Returns the number of droplets that were needed to decode the message and if the message was sucessfully decoded.

test' :: Int -> Int -> Int -> (Int, Int) -> Int -> (Int, Bool, [Decoder Word8])Source

Runs a test with a randomly generated precoding.

 test' messageLength dropletMaxDegree extraSymbols (precodingMinDegree, precodingMaxDegree) seed

decoderProgress :: Decoder a -> StringSource

A visual of Decoder progress.