From 62f971fa8a1dd2bf5b4a7dc8209ae846b433080e Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Fri, 2 Oct 2020 23:59:55 +0200 Subject: [PATCH 1/4] Added Builder Show instance --- Data/ByteString/Builder.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Data/ByteString/Builder.hs b/Data/ByteString/Builder.hs index 704b40787..fd3f3322a 100644 --- a/Data/ByteString/Builder.hs +++ b/Data/ByteString/Builder.hs @@ -478,3 +478,7 @@ stringUtf8 = P.primMapListBounded P.charUtf8 instance IsString Builder where fromString = stringUtf8 + +instance Show Builder where + showsPrec p bd = showParen (p > 10) $ + showString "lazyByteString " . shows (toLazyByteString bd) From d98104bdf90825cd0058c386052406c6e958f156 Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Sat, 3 Oct 2020 16:32:08 +0200 Subject: [PATCH 2/4] Changed Builder instance to rely on IsString instance --- Data/ByteString/Builder.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Data/ByteString/Builder.hs b/Data/ByteString/Builder.hs index fd3f3322a..908162863 100644 --- a/Data/ByteString/Builder.hs +++ b/Data/ByteString/Builder.hs @@ -480,5 +480,4 @@ instance IsString Builder where fromString = stringUtf8 instance Show Builder where - showsPrec p bd = showParen (p > 10) $ - showString "lazyByteString " . shows (toLazyByteString bd) + showsPrec p bd = shows (toLazyByteString bd) From c48e601a4f3fb6772a2778c32675d6b62b9996f0 Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Sat, 3 Oct 2020 16:36:13 +0200 Subject: [PATCH 3/4] removed unused parameter, eta-reduction in Show instance --- Data/ByteString/Builder.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ByteString/Builder.hs b/Data/ByteString/Builder.hs index 908162863..1c8d4b846 100644 --- a/Data/ByteString/Builder.hs +++ b/Data/ByteString/Builder.hs @@ -480,4 +480,4 @@ instance IsString Builder where fromString = stringUtf8 instance Show Builder where - showsPrec p bd = shows (toLazyByteString bd) + showsPrec _ = shows . toLazyByteString From fd464d37a93efc1654f268f1e242041acc6bca66 Mon Sep 17 00:00:00 2001 From: Eli Kogan-Wang Date: Sat, 3 Oct 2020 18:09:37 +0200 Subject: [PATCH 4/4] changed Show instance of Builder showsPrec -> show --- Data/ByteString/Builder.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ByteString/Builder.hs b/Data/ByteString/Builder.hs index 1c8d4b846..c5bf1660e 100644 --- a/Data/ByteString/Builder.hs +++ b/Data/ByteString/Builder.hs @@ -480,4 +480,4 @@ instance IsString Builder where fromString = stringUtf8 instance Show Builder where - showsPrec _ = shows . toLazyByteString + show = show . toLazyByteString