packages feed

binary-shared 0.8.1 → 0.8.2

raw patch · 2 files changed

+3/−4 lines, 2 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- Data.Binary.Shared: class (Typeable alpha, Ord alpha, Eq alpha, Show alpha) => BinaryShared alpha
+ Data.Binary.Shared: class (Typeable alpha, Ord alpha, Eq alpha, Show alpha) => BinaryShared alpha where putShared fput v = do { (dict, unique) <- get; case (ObjC v) `lookup` dict of { Just i -> lift (putWord8 0 >> putWord64be (fromIntegral i)) Nothing -> do { put (dict, unique + 1); lift (putWord8 1); lift (putWord64be (fromIntegral unique)); fput v; (dict2, unique2) <- get; let newDict = insert (ObjC v) unique dict2; put (newDict, unique2) } } } getShared f = do { dict <- get; w <- lift getWord8; case w of { 0 -> do { i <- lift (liftM fromIntegral (getWord64be)); case lookup i dict of { Just (ObjC obj) -> return (forceJust (cast obj) "Shared>>getShared: Cast failed") Nothing -> error $ "Shared>>getShared : Dont find in Map " ++ show i } } 1 -> do { i <- lift (liftM fromIntegral (getWord64be)); obj <- f; dict2 <- get; put (insert i (ObjC obj) dict2); return obj } _ -> error $ "Shared>>getShared : Encoding error" } }

Files

binary-shared.cabal view
@@ -1,12 +1,12 @@ name: binary-shared-version: 0.8.1+version: 0.8.2 cabal-version: -any build-type: Simple license: GPL license-file: LICENSE copyright: Juergen Nicklisch-Franken (jutaro) maintainer: maintainer@leksah.org-build-depends: base >=4.0.0.0 && <5.0.0.0, binary >=0.5,+build-depends: base >=4.5.0.0 && <5.0.0.0, binary >=0.5,                bytestring >=0.9.1.4, containers >=0.2.0.0, mtl >=1.1.0.2 homepage: http://www.leksah.org package-url: http://code.haskell.org/binary-shared
src/Data/Binary/Shared.hs view
@@ -106,8 +106,7 @@  instance Ord Object where     compare (ObjC a) (ObjC b) = if typeOf a /= typeOf b-                                then compare ((unsafePerformIO . typeRepKey . typeOf) a)-                                                ((unsafePerformIO . typeRepKey . typeOf) b)+                                then compare (typeOf a) (typeOf b)                                 else compare (Just a) (cast b)  type PutShared = St.StateT (Map Object Int, Int) PutM ()