packages feed

bytable 0.0.0.8 → 0.0.0.9

raw patch · 3 files changed

+13/−13 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Codec.Bytable: addLength :: (Bytable n, Num n) => n -> ByteString -> ByteString
- Codec.Bytable.BigEndian: instance Bytable Word8
+ Codec.Bytable: addLen :: (Bytable n, Num n) => n -> ByteString -> ByteString
+ Codec.Bytable: instance Bytable Word8

Files

bytable.cabal view
@@ -2,7 +2,7 @@ build-type:	Simple  name:		bytable-version:	0.0.0.8+version:	0.0.0.9 stability:	Experimental author:		Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer:	Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -28,7 +28,7 @@ source-repository	this     type:	git     location:	git://github.com/YoshikuniJujo/forest-    tag:	bytable-0.0.0.8+    tag:	bytable-0.0.0.9  library     hs-source-dirs:	src
src/Codec/Bytable.hs view
@@ -1,10 +1,10 @@-{-# LANGUAGE TupleSections #-}+{-# LANGUAGE PatternGuards, OverloadedStrings, TupleSections #-}  module Codec.Bytable ( 	Bytable(..), 	Parsable(..), 	BytableM(..), evalBytableM, execBytableM,-	head, take, null, list, addLength,+	head, take, null, list, addLen, ) where  import Prelude hiding (take, head, null)@@ -40,6 +40,13 @@ 	fromByteString :: BS.ByteString -> Either String b 	toByteString :: b -> BS.ByteString +instance Bytable Word8 where+	fromByteString "" = Right 0+	fromByteString bs+		| [w] <- BS.unpack bs = Right w+	fromByteString _ = Left "Codec.Bytable.BigEndian: Bytable Word8: too large"+	toByteString = BS.pack . (: [])+ instance Bytable BS.ByteString where 	fromByteString = Right 	toByteString = id@@ -73,6 +80,6 @@ 		e <- null 		if e then return [] else (:) <$> m <*> lst -addLength :: (Bytable n, Num n) => n -> BS.ByteString -> BS.ByteString-addLength t bs =+addLen :: (Bytable n, Num n) => n -> BS.ByteString -> BS.ByteString+addLen t bs = 	toByteString (fromIntegral (BS.length bs) `asTypeOf` t) `BS.append` bs
src/Codec/Bytable/BigEndian.hs view
@@ -19,13 +19,6 @@ 	fromByteString bs = Right $ byteStringToNum bs 	toByteString = integralToByteString -instance Bytable Word8 where-	fromByteString bs-		| BS.length bs <= 1 = Right $ byteStringToNum bs-		| otherwise = Left-			"Codec.Bytable.BigEndian: Bytable Word8: too large"-	toByteString = integralToByteStringN 1- instance Bytable Word16 where 	fromByteString bs 		| BS.length bs <= 2 = Right $ byteStringToNum bs