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:
Zejun Wu 2015-12-29 14:40:34 -08:00 committed by Facebook Github Bot 9
parent 4360502913
commit d9b084b86c
2 changed files with 2 additions and 4 deletions

View File

@ -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

View File

@ -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