bencoding-0.4.0.2: A library for encoding and decoding of BEncode data.

Portabilityportable
Stabilitystable
Maintainerpxqr.sta@gmail.com
Safe HaskellSafe-Inferred

Data.BEncode.Types

Contents

Description

Types for working with bencode data.

Synopsis

Types

type BInteger = IntegerSource

A bencode integer.

type BString = ByteStringSource

A raw bencode string.

type BList = [BValue]Source

A plain bencode list.

type BDict = BDictMap BValueSource

A bencode dictionary.

data BValue Source

BValue is straightforward ADT for b-encoded values. Please note that since dictionaries are sorted, in most cases we can compare BEncoded values without serialization and vice versa. Lists is not required to be sorted through.

Constructors

BInteger !BInteger

bencode integers;

BString !BString

bencode strings;

BList BList

list of bencode values;

BDict BDict

bencode key-value dictionary.

Predicates

isInteger :: BValue -> BoolSource

Test if bencoded value is an integer.

isString :: BValue -> BoolSource

Test if bencoded value is a string, both raw and utf8 encoded.

isList :: BValue -> BoolSource

Test if bencoded value is a list.

isDict :: BValue -> BoolSource

Test if bencoded value is a dictionary.