mirror of
https://github.com/facebook/Haxl.git
synced 2024-12-24 01:04:21 +03:00
Do not require Show for memoFingerprintKey
Summary: We don't need memoized value to be showable. By removing this constrait, we no longer require deriving `Show` for many user-defined data types and we support values like `Haxl a` which doesn't have a proper `Show` instance. Differential Revision: D2793617 fbshipit-source-id: f4958ca83eda97d4a27f4e1544a1078039ce6875
This commit is contained in:
parent
4360502913
commit
d9b084b86c
@ -55,7 +55,6 @@ data MemoTextKey a where
|
||||
deriving Typeable
|
||||
|
||||
deriving instance Eq (MemoTextKey a)
|
||||
deriving instance Show (MemoTextKey a)
|
||||
|
||||
instance Hashable (MemoTextKey a) where
|
||||
hashWithSalt s (MemoText t) = hashWithSalt s t
|
||||
@ -73,7 +72,6 @@ data MemoFingerprintKey a where
|
||||
deriving Typeable
|
||||
|
||||
deriving instance Eq (MemoFingerprintKey a)
|
||||
deriving instance Show (MemoFingerprintKey a)
|
||||
|
||||
instance Hashable (MemoFingerprintKey a) where
|
||||
hashWithSalt s (MemoFingerprintKey x _) =
|
||||
@ -89,5 +87,5 @@ instance Hashable (MemoFingerprintKey a) where
|
||||
--
|
||||
{-# NOINLINE memoFingerprint #-}
|
||||
memoFingerprint
|
||||
:: (Show a, Typeable a) => MemoFingerprintKey a -> GenHaxl u a -> GenHaxl u a
|
||||
:: Typeable a => MemoFingerprintKey a -> GenHaxl u a -> GenHaxl u a
|
||||
memoFingerprint key = cachedComputation key
|
||||
|
@ -725,7 +725,7 @@ runHaxl).
|
||||
--
|
||||
cachedComputation
|
||||
:: forall req u a.
|
||||
(Eq (req a)
|
||||
( Eq (req a)
|
||||
, Hashable (req a)
|
||||
, Typeable (req a))
|
||||
=> req a -> GenHaxl u a -> GenHaxl u a
|
||||
|
Loading…
Reference in New Issue
Block a user