@@ -52,17 +52,17 @@ import System.IO.Unsafe
52
52
newtype Key = UnsafeMkKey Int
53
53
54
54
pattern Key :: () => (Typeable a , Hashable a , Show a ) => a -> Key
55
- pattern Key a <- (lookupKeyValue -> KeyValue a _ )
55
+ pattern Key a <- (lookupKeyValue -> KeyValue a)
56
56
{-# COMPLETE Key #-}
57
57
58
- data KeyValue = forall a . (Typeable a , Hashable a , Show a ) => KeyValue a Text
58
+ data KeyValue = forall a . (Typeable a , Hashable a , Show a ) => KeyValue a
59
59
60
60
instance Eq KeyValue where
61
- KeyValue a _ == KeyValue b _ = Just a == cast b
61
+ KeyValue a == KeyValue b = Just a == cast b
62
62
instance Hashable KeyValue where
63
- hashWithSalt i (KeyValue x _ ) = hashWithSalt i (typeOf x, x)
63
+ hashWithSalt i (KeyValue x) = hashWithSalt i (typeOf x, x)
64
64
instance Show KeyValue where
65
- show (KeyValue _ t ) = T. unpack t
65
+ show (KeyValue k ) = show k
66
66
67
67
data GlobalKeyValueMap = GlobalKeyValueMap ! (Map. HashMap KeyValue Key ) ! (IntMap KeyValue ) {- # UNPACK #-} !Int
68
68
@@ -73,7 +73,7 @@ keyMap = unsafePerformIO $ newIORef (GlobalKeyValueMap Map.empty IM.empty 0)
73
73
74
74
newKey :: (Typeable a , Hashable a , Show a ) => a -> Key
75
75
newKey k = unsafePerformIO $ do
76
- let ! newKey = KeyValue k ( T. pack ( show k))
76
+ let ! newKey = KeyValue k
77
77
atomicModifyIORef' keyMap $ \ km@ (GlobalKeyValueMap hm im n) ->
78
78
let new_key = Map. lookup newKey hm
79
79
in case new_key of
@@ -98,7 +98,7 @@ instance Show Key where
98
98
show (Key x) = show x
99
99
100
100
renderKey :: Key -> Text
101
- renderKey (lookupKeyValue -> KeyValue _ t ) = t
101
+ renderKey (lookupKeyValue -> KeyValue k ) = T. pack ( show k)
102
102
103
103
newtype KeySet = KeySet IntSet
104
104
deriving newtype (Eq , Ord , Semigroup , Monoid , NFData )
0 commit comments