packages feed

shake 0.3.8 → 0.3.9

raw patch · 3 files changed

+12/−8 lines, 3 filesdep ~hashable

Dependency ranges changed: hashable

Files

Development/Shake/Directory.hs view
@@ -46,7 +46,7 @@     rnf (GetDirDirs a) = rnf a  instance Hashable GetDir where-    hash = hash . f+    hashWithSalt salt = hashWithSalt salt . f         where f (GetDir x) = (0 :: Int, x, "")               f (GetDirFiles x y) = (1, x, y)               f (GetDirDirs x) = (2, x, "")
Development/Shake/Value.hs view
@@ -15,6 +15,7 @@ import Data.Typeable  import Data.Bits+import Data.Function import Data.IORef import Data.List import Data.Maybe@@ -59,7 +60,7 @@     rnf (Value a) = rnf a  instance Hashable Value where-    hash (Value a) = hash (typeOf a) `xor` hash a+    hashWithSalt salt (Value a) = hashWithSalt salt (typeOf a) `xor` hashWithSalt salt a  instance Eq Value where     Value a == Value b = case cast b of@@ -77,7 +78,10 @@ registerWitness :: (Eq a, Show a, Typeable a, Hashable a, Binary a, NFData a) => a -> IO () registerWitness x = modifyIORef witness $ Map.insert (typeOf x) (Value $ undefined `asTypeOf` x) +toAscList :: Show k => Map.HashMap k v -> [(k,v)]+toAscList = sortBy (compare `on` show . fst) . Map.toList + data Witness = Witness     {typeNames :: [String] -- the canonical data, the names of the types     ,witnessIn :: Map.HashMap Word16 Value -- for reading in, the find the values (some may be missing)@@ -85,14 +89,14 @@     }  instance Eq Witness where-    -- type names are ordered by the Map (on hash), so likely to remain reasonably consistent+    -- type names are ordered by TypeRep values, so should to remain reasonably consistent     -- regardless of the order of registerWitness calls     a == b = typeNames a == typeNames b  currentWitness :: IO Witness currentWitness = do     ws <- readIORef witness-    let (ks,vs) = unzip $ Map.toList ws+    let (ks,vs) = unzip $ toAscList ws     return $ Witness (map show ks) (Map.fromList $ zip [0..] vs) (Map.fromList $ zip ks [0..])  @@ -100,7 +104,7 @@     put (Witness ts _ _) = put ts     get = do         ts <- get-        let ws = Map.toList $ unsafePerformIO $ readIORef witness+        let ws = toAscList $ unsafePerformIO $ readIORef witness         let (is,ks,vs) = unzip3 [(i,k,v) | (i,t) <- zip [0..] ts, (k,v):_ <- [filter ((==) t . show . fst) ws]]         return $ Witness ts (Map.fromList $ zip is vs) (Map.fromList $ zip ks is) 
shake.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.8 build-type:         Simple name:               shake-version:            0.3.8+version:            0.3.9 license:            BSD3 license-file:       LICENSE category:           Development@@ -66,7 +66,7 @@         base == 4.*,         old-time,         directory,-        hashable >= 1.1.2.3 && < 1.2,+        hashable >= 1.1.2.3 && < 1.3,         binary,         filepath,         process,@@ -117,7 +117,7 @@         base == 4.*,         old-time,         directory,-        hashable >= 1.1.2.3 && < 1.2,+        hashable >= 1.1.2.3 && < 1.3,         binary,         filepath,         process,