Changeset 12571 for third-party
- Timestamp:
- 08/21/06 20:01:28 (2 years ago)
- Location:
- third-party/HsJudy
- Files:
-
- 3 modified
-
Judy/HashIO.hs (modified) (2 diffs)
-
Judy/Refeable.hs (modified) (2 diffs)
-
tests/TestIntMap.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
third-party/HsJudy/Judy/HashIO.hs
r12103 r12571 10 10 11 11 import Judy.Private 12 import GHC.Exts (unsafeCoerce#) 12 13 13 14 class HashIO a where … … 22 23 instance Enum a => UniqueHashIO a where 23 24 instance Enum a => HashIO a where 24 hashIO = return . toEnum. fromEnum25 hashIO = return . unsafeCoerce# . fromEnum 25 26 instance Enum a => ReversibleHashIO a where 26 unHashIO = return . toEnum . fromEnum27 unHashIO = return . toEnum . unsafeCoerce# 27 28 28 29 -
third-party/HsJudy/Judy/Refeable.hs
r12204 r12571 13 13 import Judy.Private 14 14 import qualified Judy.MiniGC as GC 15 15 import GHC.Exts (unsafeCoerce#) 16 16 17 17 -- FIXME: It results in an illegal instruction if I take the "Dummy a" … … 35 35 36 36 instance Refeable Int where 37 toRef i = return $ toEnumi38 fromRef v = return $ fromEnumv37 toRef i = return $ unsafeCoerce# i 38 fromRef v = return $ unsafeCoerce# v 39 39 needGC _ = False 40 40 -
third-party/HsJudy/tests/TestIntMap.hs
r12505 r12571 16 16 insert 1 42 s 17 17 lookup 1 s .=> Just 42 18 19 t "Negative values" $ do 20 s <- new :: IO (IntMap Int Int) 21 insert 1 (-1) s 22 insert 2 (-2) s 23 lookup 1 s .=> Just (-1) 24 lookup 2 s .=> Just (-2) 18 25 19 26 t "Delete" $ do … … 161 168 J.takeLast 1 m .=> [(98,198)] 162 169 170 t "Negative keys" $ do 171 s <- new :: IO (IntMap Int Int) 172 insert (-1) (-1) s 173 insert (-2) (-2) s 174 insert 1 3 s 175 insert (-3) 4 s 176 lookup (-1) s .=> Just (-1) 177 lookup (-2) s .=> Just (-2) 178 lookup 1 s .=> Just 3 179 lookup (-3) s .=> Just 4 180 181 182 163 183 -- TODO: test some crazy haskell type as value (to check stableptrs)
