{-# LANGUAGE FlexibleInstances #-}moduleNetwork.HTTP.Types.QueryLike(QueryLike(..),QueryKeyLike(..),QueryValueLike(..))whereimportNetwork.HTTP.Types.URIimportData.MaybeimportqualifiedData.ByteStringasBimportqualifiedData.ByteString.LazyasLimportqualifiedData.TextasTimportqualifiedData.Text.EncodingasTimportControl.Arrow-- | Types which can, and commonly are, converted to 'Query' are in this class.-- -- You can use lists of simple key value pairs, with 'B.ByteString' (strict, or lazy: -- 'L.ByteString'), 'T.Text', or 'String' as the key/value types. You can also have the value-- type lifted into a Maybe to support keys without values; and finally it is possible to put-- each pair into a Maybe for key-value pairs that aren't always present.classQueryLikeawhere-- | Convert to 'Query'.toQuery::a->Query-- | Types which, in a Query-like key-value list, are used in the Key position.classQueryKeyLikeawheretoQueryKey::a->B.ByteString-- | Types which, in a Query-like key-value list, are used in the Value position.classQueryValueLikeawheretoQueryValue::a->MaybeB.ByteStringinstance(QueryKeyLikek,QueryValueLikev)=>QueryLike[(k,v)]wheretoQuery=map(toQueryKey***toQueryValue)instance(QueryKeyLikek,QueryValueLikev)=>QueryLike[Maybe(k,v)]wheretoQuery=toQuery.catMaybesinstanceQueryKeyLikeB.ByteStringwheretoQueryKey=idinstanceQueryKeyLikeL.ByteStringwheretoQueryKey=B.concat.L.toChunksinstanceQueryKeyLikeT.TextwheretoQueryKey=T.encodeUtf8instanceQueryKeyLike[Char]wheretoQueryKey=T.encodeUtf8.T.packinstanceQueryValueLikeB.ByteStringwheretoQueryValue=JustinstanceQueryValueLikeL.ByteStringwheretoQueryValue=Just.B.concat.L.toChunksinstanceQueryValueLikeT.TextwheretoQueryValue=Just.T.encodeUtf8instanceQueryValueLike[Char]wheretoQueryValue=Just.T.encodeUtf8.T.packinstanceQueryValueLikea=>QueryValueLike(Maybea)wheretoQueryValue=maybeNothingtoQueryValue