bencode-0.6.1.1: Parsers and printers for bencoded data.

Copyright | (c) 2005 Jesper Louis Andersen <jlouis@mongers.org> 2006 Lemmih <lemmih@gmail.com>
License | BSD3
Maintainer | lemmih@gmail.com
Stability | believed to be stable
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.BEncode

Contents

- Data types
- Functions

Description

Provides a BEncode data type is well as functions for converting this data type to and from a String.

Also supplies a number of properties which the module must satisfy.

Synopsis

- data BEncode
  - = BInt Integer
  - | BString ByteString
  - | BList [BEncode]
  - | BDict (Map String BEncode)
- bRead :: ByteString -> Maybe BEncode
- bShow :: BEncode -> ShowS
- bPack :: BEncode -> ByteString

# Data types

data BEncode Source #

The B-coding defines an abstract syntax tree given as a simple data type here

Constructors

BInt Integer |
BString ByteString |
BList [BEncode] |
BDict (Map String BEncode) |

#### Instances

Instances details

Binary BEncode Source # |
Instance details Defined in Data.BEncode Methods put :: BEncode -> Put Source # get :: Get BEncode Source # putList :: [BEncode] -> Put Source #
Show BEncode Source # |
Instance details Defined in Data.BEncode Methods showsPrec :: Int -> BEncode -> ShowS Source # show :: BEncode -> String Source # showList :: [BEncode] -> ShowS Source #
Eq BEncode Source # |
Instance details Defined in Data.BEncode Methods (==) :: BEncode -> BEncode -> Bool Source # (/=) :: BEncode -> BEncode -> Bool Source #
Ord BEncode Source # |
Instance details Defined in Data.BEncode Methods compare :: BEncode -> BEncode -> Ordering Source # (<) :: BEncode -> BEncode -> Bool Source # (<=) :: BEncode -> BEncode -> Bool Source # (>) :: BEncode -> BEncode -> Bool Source # (>=) :: BEncode -> BEncode -> Bool Source # max :: BEncode -> BEncode -> BEncode Source # min :: BEncode -> BEncode -> BEncode Source #

# Functions

bRead :: ByteString -> Maybe BEncode Source #

bRead is a conversion routine. It assumes a B-coded string as input and attempts a parse of it into a BEncode data type

bShow :: BEncode -> ShowS Source #

Render a BEncode structure to a B-coded string

bPack :: BEncode -> ByteString Source #