bencode 0.5 → 0.5.0.1
raw patch · 5 files changed
+40/−63 lines, 5 filesnew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- LICENSE +3/−0
- bencode.cabal +17/−15
- src/Data/BEncode.hs +6/−24
- src/Data/BEncode/Lexer.hs +10/−1
- src/Data/BEncode/Parser.hs +4/−23
LICENSE view
@@ -1,4 +1,7 @@ Copyright (c) 2005-2007, David Himmelstrup+ 2005-2006 Lemmih <lemmih@gmail.com>+ 2005 Jesper Louis Andersen <jlouis@mongers.org>+ All rights reserved. Redistribution and use in source and binary forms,
bencode.cabal view
@@ -1,19 +1,21 @@-Name: bencode-Version: 0.5-Maintainer: Lemmih (lemmih@gmail.com)-Author: Lemmih (lemmih@gmail.com), Jesper Louis Andersen-Copyright: 2005-2009, Lemmih-License-File: LICENSE-License: BSD3-Build-Depends: base<5, parsec, bytestring, containers, binary-Build-Type: Simple-Category: Text-Synopsis: Parser and printer for bencoded data.-Tested-with: GHC ==6.8.1, GHC ==6.10.2-Extensions: PatternGuards+Name: bencode+Version: 0.5.0.1+Maintainer: Lemmih (lemmih@gmail.com)+Author: Lemmih (lemmih@gmail.com), Jesper Louis Andersen+Copyright: (c) 2005-2009, David Himmelstrup+ 2006 Lemmih <lemmih@gmail.com>+ 2005 Jesper Louis Andersen <jlouis@mongers.org>+License-File: LICENSE+License: BSD3+Build-Depends: base<5, parsec, bytestring, containers, binary+Build-Type: Simple+Category: Text+Synopsis: Parser and printer for bencoded data.+Tested-with: GHC ==6.8.1, GHC ==6.10.2+Extensions: PatternGuards Exposed-Modules: Data.BEncode Data.BEncode.Lexer Data.BEncode.Parser-GHC-Options: -Wall-Hs-Source-Dirs: src+GHC-Options: -Wall+Hs-Source-Dirs: src
src/Data/BEncode.hs view
@@ -1,31 +1,13 @@-{--- Copyright (c) 2005 Jesper Louis Andersen <jlouis@mongers.org>- Lemmih <lemmih@gmail.com>-- Permission to use, copy, modify, and distribute this software for any- purpose with or without fee is hereby granted, provided that the above- copyright notice and this permission notice appear in all copies.-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.---} ----------------------------------------------------------------------------- -- | -- Module : BEncode--- Copyright : (c) Jesper Louis Andersen, 2005. (c) Lemmih, 2006--- License : BSD-style--- +-- 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--- +-- -- Provides a BEncode data type is well as functions for converting this -- data type to and from a String. --@@ -34,7 +16,7 @@ module Data.BEncode ( -- * Data types- BEncode(..), + BEncode(..), -- * Functions bRead, bShow,@@ -137,7 +119,7 @@ sc = showChar ss = showString sKV (k,v) = sString k (length k) . bShow' v- sDict dict = foldr (.) id (map sKV (Map.toAscList dict)) + sDict dict = foldr (.) id (map sKV (Map.toAscList dict)) sList list = foldr (.) id (map bShow' list) sString str len = shows len . sc ':' . ss str bShow' b =
src/Data/BEncode/Lexer.hs view
@@ -1,3 +1,13 @@+-----------------------------------------------------------------------------+-- |+-- Module : BEncode.Lexer+-- 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+----------------------------------------------------------------------------- module Data.BEncode.Lexer where import Data.Char@@ -37,4 +47,3 @@ | otherwise -> error "Lexer error." where ch = L.head fs rest = L.tail fs-
src/Data/BEncode/Parser.hs view
@@ -1,30 +1,12 @@-{--- Copyright (c) 2005 Lemmih <lemmih@gmail.com>-- Permission to use, copy, modify, and distribute this software for any- purpose with or without fee is hereby granted, provided that the above- copyright notice and this permission notice appear in all copies.-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.---} ----------------------------------------------------------------------------- -- | -- Module : BParser--- Copyright : (c) Lemmih, 2005--- License : BSD-style (see the file libraries/base/LICENSE)--- +-- Copyright : (c) 2005 Lemmih <lemmih@gmail.com>+-- License : BSD3 -- Maintainer : lemmih@gmail.com -- Stability : stable -- Portability : portable--- +-- -- A parsec style parser for BEncoded data ----------------------------------------------------------------------------- module Data.BEncode.Parser@@ -55,8 +37,8 @@ mplus (BParser a) (BParser b) = BParser $ \st -> case a st of Error _err -> b st ok -> ok- + runB :: BParser a -> BEncode -> Reply a runB (BParser b) = b @@ -126,4 +108,3 @@ setInput :: BEncode -> BParser () setInput b = BParser $ \_ -> Ok () b-