summaryrefslogtreecommitdiff
path: root/overlays/spm/lib/Data/CaseInsensitive/Instances.hs
blob: 1476b9d93a13a570cd8762d79d26d9cad6652ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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