Merge pull request #129 from aforemny/haskell-attoparsec-binary

Haskell attoparsec binary
This commit is contained in:
Peter Simons 2012-09-22 02:55:45 -07:00
commit 88f166bf61
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,20 @@
diff --git a/Data/Attoparsec/Binary.hs b/Data/Attoparsec/Binary.hs
index fab76c6..01d6c8b 100644
--- a/Data/Attoparsec/Binary.hs
+++ b/Data/Attoparsec/Binary.hs
@@ -23,7 +23,7 @@ import Data.Word
byteSize :: (Bits a) => a -> Int
byteSize = (`div` 8) . bitSize
-pack :: (Bits a) => B.ByteString -> a
+pack :: (Bits a, Num a) => B.ByteString -> a
pack = B.foldl' (\n h -> (n `shiftL` 8) .|. fromIntegral h) 0
anyWordN :: (Bits a) => (B.ByteString -> a) -> Parser a
@@ -84,4 +84,4 @@ word64be = wordN unpack
-- |Match a specific 64-bit little-endian word.
word64le :: Word64 -> Parser Word64
-word64le = wordN $ B.reverse . unpack
\ No newline at end of file
+word64le = wordN $ B.reverse . unpack

View File

@ -0,0 +1,14 @@
{ cabal, attoparsec }:
cabal.mkDerivation (self: {
pname = "attoparsec-binary";
version = "0.1.0.1";
sha256 = "1d3zjr8bh6d44v1vid0cvrrbyhn7xj4bn96vy36dzk7h7p87bzxa";
buildDepends = [ attoparsec ];
patches = [ ./attoparsec-binary-ghc7.6.1.patch ];
meta = {
description = "Binary processing extensions to Attoparsec";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
};
})

View File

@ -425,6 +425,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
attoparsec = callPackage ../development/libraries/haskell/attoparsec {};
attoparsecBinary = callPackage ../development/libraries/haskell/attoparsec-binary {};
attoparsecConduit = callPackage ../development/libraries/haskell/attoparsec-conduit {};
attoparsecEnumerator = callPackage ../development/libraries/haskell/attoparsec/enumerator.nix {};