@@ -52,17 +52,17 @@ import System.IO.Unsafe
5252newtype Key = UnsafeMkKey Int
5353
5454pattern Key :: () => (Typeable a , Hashable a , Show a ) => a -> Key
55- pattern Key a <- (lookupKeyValue -> KeyValue a _ )
55+ pattern Key a <- (lookupKeyValue -> KeyValue a)
5656{-# COMPLETE Key #-}
5757
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
5959
6060instance Eq KeyValue where
61- KeyValue a _ == KeyValue b _ = Just a == cast b
61+ KeyValue a == KeyValue b = Just a == cast b
6262instance Hashable KeyValue where
63- hashWithSalt i (KeyValue x _ ) = hashWithSalt i (typeOf x, x)
63+ hashWithSalt i (KeyValue x) = hashWithSalt i (typeOf x, x)
6464instance Show KeyValue where
65- show (KeyValue _ t ) = T. unpack t
65+ show (KeyValue k ) = show k
6666
6767data GlobalKeyValueMap = GlobalKeyValueMap ! (Map. HashMap KeyValue Key ) ! (IntMap KeyValue ) {- # UNPACK #-} !Int
6868
@@ -73,7 +73,7 @@ keyMap = unsafePerformIO $ newIORef (GlobalKeyValueMap Map.empty IM.empty 0)
7373
7474newKey :: (Typeable a , Hashable a , Show a ) => a -> Key
7575newKey k = unsafePerformIO $ do
76- let ! newKey = KeyValue k ( T. pack ( show k))
76+ let ! newKey = KeyValue k
7777 atomicModifyIORef' keyMap $ \ km@ (GlobalKeyValueMap hm im n) ->
7878 let new_key = Map. lookup newKey hm
7979 in case new_key of
@@ -98,7 +98,7 @@ instance Show Key where
9898 show (Key x) = show x
9999
100100renderKey :: Key -> Text
101- renderKey (lookupKeyValue -> KeyValue _ t ) = t
101+ renderKey (lookupKeyValue -> KeyValue k ) = T. pack ( show k)
102102
103103newtype KeySet = KeySet IntSet
104104 deriving newtype (Eq , Ord , Semigroup , Monoid , NFData )
0 commit comments