From fc6cf6169868e60c189e4b243330c3717ff159f3 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 26 May 2022 13:58:07 +0200 Subject: ... --- overlays/spm/lib/Data/CaseInsensitive/Instances.hs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 overlays/spm/lib/Data/CaseInsensitive/Instances.hs (limited to 'overlays/spm/lib/Data/CaseInsensitive') diff --git a/overlays/spm/lib/Data/CaseInsensitive/Instances.hs b/overlays/spm/lib/Data/CaseInsensitive/Instances.hs new file mode 100644 index 00000000..1476b9d9 --- /dev/null +++ b/overlays/spm/lib/Data/CaseInsensitive/Instances.hs @@ -0,0 +1,22 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module Data.CaseInsensitive.Instances () where + +import Prelude + +import Data.CaseInsensitive (CI) +import qualified Data.CaseInsensitive as CI + +import Servant.API.ContentTypes + +import Data.Aeson + + +instance MimeRender PlainText a => MimeRender PlainText (CI a) where + mimeRender p = mimeRender p . CI.original + +instance ToJSON a => ToJSON (CI a) where + toJSON = toJSON . CI.original + +instance (FromJSON a, CI.FoldCase a) => FromJSON (CI a) where + parseJSON = fmap CI.mk . parseJSON -- cgit v1.2.3