packages feed

OpenAFP 1.3.2 → 1.4.0

raw patch · 5 files changed

+36/−21 lines, 5 filesdep +hashabledep +hashtables

Dependencies added: hashable, hashtables

Files

+ ChangeLog view
@@ -0,0 +1,4 @@+# 1.4.0++* Switch to hashtables & hashable packages for GHC 7.8.1 compatibility.+* New hashCreate API that simply returns a hash table, with Eq and Hash inferred from typeclasses.
OpenAFP.cabal view
@@ -1,5 +1,5 @@ name:               OpenAFP-version:            1.3.2+version:            1.4.0 license:            PublicDomain License-file:       LICENSE cabal-version:      >= 1.6@@ -11,9 +11,11 @@ description:        IBM AFP document format parser and generator category:           Data build-type:         Simple+extra-source-files: ChangeLog+ library     build-depends:      base >= 2 && < 5, mtl, regex-compat, directory, process,-                        array, containers, binary, bytestring+                        array, containers, binary, bytestring, hashtables, hashable     hs-source-dirs:     src     ghc-options:        -funbox-strict-fields -fno-warn-missing-signatures     extensions:         MagicHash, DeriveDataTypeable, GeneralizedNewtypeDeriving,
src/OpenAFP/Internals.hs view
@@ -18,7 +18,8 @@      IOm, StateIO, BS, -    hashNew, hashLookup, hashInsert, hashDelete,+    HashTable,+    hashCreate, hashNew, hashLookup, hashInsert, hashDelete,     stateGet, statePut ) where import OpenAFP.Internals.Binary  as X @@ -35,7 +36,6 @@ import Data.Bits                 as X  import Data.Char                 as X  import Data.List                 as X -import Data.HashTable            as X hiding (lookup, insert, delete, new) import Data.Word                 as X  import Data.Typeable             as X  import Data.IORef                as X @@ -61,17 +61,27 @@ import System.IO.Error           as X  import System.Directory          as X  import Text.Regex                as X -import GHC.IOBase                as X (IOArray, newIOArray, readIOArray, writeIOArray)+import GHC.IOArray               as X (IOArray, newIOArray, readIOArray, writeIOArray)+import Data.Hashable (Hashable) import qualified Control.Monad.RWS (get, put) import qualified Control.Monad.State (MonadState)-import qualified Data.HashTable (lookup, insert, delete, new)+import qualified Data.HashTable.IO+import qualified Data.HashTable.Class as H import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L -hashNew     = Data.HashTable.new-hashLookup  = Data.HashTable.lookup-hashInsert  = Data.HashTable.insert-hashDelete  = Data.HashTable.delete+type HashTable k v = Data.HashTable.IO.CuckooHashTable k v++hashNew :: a -> b -> IO (HashTable k v)+hashNew _ _ = Data.HashTable.IO.new+hashCreate :: IO (HashTable k v)+hashCreate = Data.HashTable.IO.new+hashLookup :: (Eq k, Hashable k) => HashTable k v -> k -> IO (Maybe v)+hashLookup  = Data.HashTable.IO.lookup+hashInsert :: (Eq k, Hashable k) => HashTable k v -> k -> v -> IO ()+hashInsert  = Data.HashTable.IO.insert+hashDelete :: (Eq k, Hashable k) => HashTable k v -> k -> IO ()+hashDelete  = Data.HashTable.IO.delete  type BS = S.ByteString type BL = L.ByteString
src/OpenAFP/Internals/Binary.hs view
@@ -16,6 +16,7 @@ import Data.Int import Data.Word import Data.Typeable+import Data.Hashable            ( Hashable ) import Control.Monad            ( when, liftM ) import System.IO as IO import System.IO.Error          ( mkIOError, eofErrorType )@@ -32,7 +33,6 @@ import Foreign.ForeignPtr  import GHC.Base-import GHC.IOBase  import Data.Binary.Get import Data.Binary.Put@@ -49,15 +49,15 @@ newtype A8 = A8 Word64 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Bounded) newtype A12 = A12 Integer deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable) -newtype I1 = I1 Int8 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show)-newtype I2 = I2 Int16 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show)-newtype I4 = I4 Int32 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show)-newtype I8 = I8 Int64 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show)+newtype I1 = I1 Int8 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show, Hashable)+newtype I2 = I2 Int16 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show, Hashable)+newtype I4 = I4 Int32 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show, Hashable)+newtype I8 = I8 Int64 deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Ix, IArray UArray, Show, Hashable) -newtype N1 = N1 { fromN1 :: Word8 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Binary, Ix, IArray UArray, Bounded)-newtype N2 = N2 { fromN2 :: Word16 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Binary, Bounded)-newtype N3 = N3 { fromN3 :: Word32 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable)-newtype N4 = N4 { fromN4 :: Word32 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Binary, Bounded)+newtype N1 = N1 { fromN1 :: Word8 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Binary, Ix, IArray UArray, Bounded, Hashable)+newtype N2 = N2 { fromN2 :: Word16 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Binary, Bounded, Hashable)+newtype N3 = N3 { fromN3 :: Word32 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Hashable)+newtype N4 = N4 { fromN4 :: Word32 } deriving (Ord, Enum, Real, Integral, Eq, Num, Bits, Typeable, Storable, Binary, Bounded, Hashable)  data N0 = N0 deriving (Show, Ord, Enum, Eq, Typeable, Ix, Bounded) 
src/OpenAFP/Types/Chunk.hs view
@@ -78,8 +78,7 @@ mkChunkType = MkChunkType  typeInt :: TypeRep -> Int-typeInt x = unsafeCoerce (unsafePerformIO (typeRepKey x))-+typeInt x = error "No longer needed for Hashable, as TypeRep becomes part of Ord" #else newtype ChunkType = MkChunkType Int     deriving (Show, Eq, Typeable, Ord)