{-# OPTIONS_GHC -fno-warn-orphans #-} module URI.ByteString.Aeson () where import Data.Aeson import qualified Data.ByteString as BS import URI.ByteString import Data.Text.Encoding import Control.Monad class ParseJSONURI a where parseJSONURI :: BS.ByteString -> Either URIParseError (URIRef a) instance ParseJSONURI Absolute where parseJSONURI :: ByteString -> Either URIParseError (URIRef Absolute) parseJSONURI = URIParserOptions -> ByteString -> Either URIParseError (URIRef Absolute) parseURI URIParserOptions laxURIParserOptions instance ParseJSONURI Relative where parseJSONURI :: ByteString -> Either URIParseError (URIRef Relative) parseJSONURI = URIParserOptions -> ByteString -> Either URIParseError (URIRef Relative) parseRelativeRef URIParserOptions laxURIParserOptions instance ParseJSONURI a => FromJSON (URIRef a) where parseJSON :: Value -> Parser (URIRef a) parseJSON = forall a. FromJSON a => Value -> Parser a parseJSON forall (m :: * -> *) a b c. Monad m => (a -> m b) -> (b -> m c) -> a -> m c >=> forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either (forall (m :: * -> *) a. MonadFail m => String -> m a fail forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a. Show a => a -> String show) forall (f :: * -> *) a. Applicative f => a -> f a pure forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a. ParseJSONURI a => ByteString -> Either URIParseError (URIRef a) parseJSONURI forall b c a. (b -> c) -> (a -> b) -> a -> c . Text -> ByteString encodeUtf8 instance ToJSON (URIRef f) where toJSON :: URIRef f -> Value toJSON = forall a. ToJSON a => a -> Value toJSON forall b c a. (b -> c) -> (a -> b) -> a -> c . ByteString -> Text decodeUtf8 forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a. URIRef a -> ByteString serializeURIRef'