From bcef15db14a33ffdb363eb5bc1136ea60f23d81b Mon Sep 17 00:00:00 2001 From: Alexey Radkov Date: Tue, 28 Jul 2020 18:42:45 +0300 Subject: [PATCH] Put original string instead of foldedCase The foldedCase is derivative of the original string, while the latter is unique. So, putting foldedCase instead of original string leads to loss of data, while getting from the original string must always restore CI object correctly as it has been built from the original string. Probably it should also fix weird cases like in issue #7. My own case was restoring serialized ResponseHeaders from Network.HTTP.Types. Say, putting Custom-Header and restoring it later makes it custom-header (when I take it with original), while when putting original string it restores correctly as Custom-Header (when I take it with original). --- src/Data/Binary/Instances/CaseInsensitive.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Binary/Instances/CaseInsensitive.hs b/src/Data/Binary/Instances/CaseInsensitive.hs index 37528b7..1d3d052 100644 --- a/src/Data/Binary/Instances/CaseInsensitive.hs +++ b/src/Data/Binary/Instances/CaseInsensitive.hs @@ -8,4 +8,4 @@ import qualified Data.CaseInsensitive as CI instance (CI.FoldCase a, Binary a) => Binary (CI.CI a) where get = fmap CI.mk get - put = put . CI.foldedCase + put = put . CI.original