From d9b084b86c99749a801ca4cbb16cf201fa027ed1 Mon Sep 17 00:00:00 2001 From: Zejun Wu Date: Tue, 29 Dec 2015 14:40:34 -0800 Subject: [PATCH] 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 --- Haxl/Core/Memo.hs | 4 +--- Haxl/Core/Monad.hs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Haxl/Core/Memo.hs b/Haxl/Core/Memo.hs index d907bf3..fa4a731 100644 --- a/Haxl/Core/Memo.hs +++ b/Haxl/Core/Memo.hs @@ -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 diff --git a/Haxl/Core/Monad.hs b/Haxl/Core/Monad.hs index 2a7f3fd..63921e4 100644 --- a/Haxl/Core/Monad.hs +++ b/Haxl/Core/Monad.hs @@ -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