Commits

FlorianHartwig committed e3036a1

Add some basic haddock documentation

  • Participants
  • Parent commits 731657e

Comments (0)

Files changed (3)

File src/Data/AttoBencode/Encode.hs

 import qualified Data.ByteString.Char8 as B
 import Data.Word (Word8)
 
+-- | Serialise a Benocde value to a (strict) ByteString
 encode :: BValue -> B.ByteString
 encode = toByteString . fromBValue
 

File src/Data/AttoBencode/Parser.hs

 import Data.Map
 import qualified Data.ByteString as B
 
+-- | Deserialise a ByteString to a BValue.
+-- If parsing fails, Nothing is returned.
 decode :: B.ByteString -> Maybe BValue
 decode = maybeResult . parse bValue
 
+-- | Parser for Bencode values
 bValue :: Parser BValue
 bValue = stringParser <|> intParser <|> listParser <|> dictParser
 

File src/Data/AttoBencode/Types.hs

 import Data.Map (Map)
 import qualified Data.ByteString as B
 
+-- | The Haskell data type for Bencode values
 data BValue = BString !B.ByteString
             | BInt !Integer
             | BList ![BValue]
             | BDict !Dict
     deriving (Show, Eq)
 
+-- | A Bencode dictionary is a map from ByteStrings to Bencode values
 type Dict = Map B.ByteString BValue