{-# OPTIONS_GHC -fno-warn-orphans #-}

module Network.IPFS.Internal.Orphanage.ByteString.Lazy () where

import qualified RIO.ByteString.Lazy as Lazy
import           Servant

import           Network.IPFS.Prelude

instance MimeRender PlainText Lazy.ByteString where
  mimeRender :: Proxy PlainText -> ByteString -> ByteString
mimeRender Proxy PlainText
_proxy = ByteString -> ByteString
forall a. a -> a
identity

instance FromJSON Lazy.ByteString where
  parseJSON :: Value -> Parser ByteString
parseJSON = String -> (Text -> Parser ByteString) -> Value -> Parser ByteString
forall a. String -> (Text -> Parser a) -> Value -> Parser a
withText String
"ByteString" (ByteString -> Parser ByteString
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ByteString -> Parser ByteString)
-> (Text -> ByteString) -> Text -> Parser ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
Lazy.fromStrict (ByteString -> ByteString)
-> (Text -> ByteString) -> Text -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
encodeUtf8)