refactor: Remove Protolude.Conv from GucHeader

This commit is contained in:
monacoremo
2021-11-12 20:25:22 +01:00
committed by Remo
parent a2c2544271
commit 15ea7dfe09
+4 -5
View File
@@ -10,8 +10,7 @@ import qualified Data.HashMap.Strict as M
import Network.HTTP.Types.Header (Header) import Network.HTTP.Types.Header (Header)
import Protolude hiding (toS) import Protolude
import Protolude.Conv (toS)
{-| {-|
@@ -21,9 +20,9 @@ import Protolude.Conv (toS)
newtype GucHeader = GucHeader (CI.CI ByteString, ByteString) newtype GucHeader = GucHeader (CI.CI ByteString, ByteString)
instance JSON.FromJSON GucHeader where instance JSON.FromJSON GucHeader where
parseJSON (JSON.Object o) = case headMay (M.toList o) of parseJSON (JSON.Object o) =
Just (k, JSON.String s) | M.size o == 1 -> pure $ GucHeader (CI.mk $ toS k, toS s) case M.toList o of
| otherwise -> mzero [(k, JSON.String s)] -> pure $ GucHeader (CI.mk $ toUtf8 k, toUtf8 s)
_ -> mzero _ -> mzero
parseJSON _ = mzero parseJSON _ = mzero