Skip to content

zbo14/bencode-hs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bencode-hs

Small bencoding library in haskell.

example:

module Main where

import Bencode (decode,encode)
import Data.Map (empty)
import Value (consInt,consString,insertList,insertString,wrap)

main :: IO ()
main = do 
    let l = consInt 123 $ consString "abc" []
        d = insertString "string" "v a p o r vv a v e" $ insertList "list" l empty
        s = encode $ wrap d
    putStrLn s
    -- d4:listli123e3:abce6:string18:v a p o r vv a v ee
    putStrLn . show $ decode s
    -- Just (D (fromList [("list",L [I 123,S "abc"]),("string",S "v a p o r vv a v e")]),49,"")

About

small bencoding library in haskell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published