{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE Trustworthy, FlexibleInstances #-}

-- | This module exports all the things at the same time.
module Network.HTTP.Link (
  module Network.HTTP.Link.Types
, module Network.HTTP.Link.Writer
, module Network.HTTP.Link.Parser
) where

import           Data.ByteString.Conversion
import           Web.HttpApiData
import safe      Network.HTTP.Link.Types
import safe      Network.HTTP.Link.Writer
import safe      Network.HTTP.Link.Parser

instance ToByteString [Link] where
  builder :: [Link] -> Builder
builder = Text -> Builder
forall a. ToByteString a => a -> Builder
builder (Text -> Builder) -> ([Link] -> Text) -> [Link] -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Link] -> Text
writeLinkHeader

instance ToByteString Link where
  builder :: Link -> Builder
builder = Text -> Builder
forall a. ToByteString a => a -> Builder
builder (Text -> Builder) -> (Link -> Text) -> Link -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Link -> Text
writeLink

instance ToHttpApiData [Link] where
  toUrlPiece :: [Link] -> Text
toUrlPiece = Text -> Text
forall a. ToHttpApiData a => a -> Text
toUrlPiece (Text -> Text) -> ([Link] -> Text) -> [Link] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Link] -> Text
writeLinkHeader
  toHeader :: [Link] -> ByteString
toHeader = [Link] -> ByteString
forall a. ToByteString a => a -> ByteString
toByteString'

instance ToHttpApiData Link where
  toUrlPiece :: Link -> Text
toUrlPiece = Text -> Text
forall a. ToHttpApiData a => a -> Text
toUrlPiece (Text -> Text) -> (Link -> Text) -> Link -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Link -> Text
writeLink
  toHeader :: Link -> ByteString
toHeader = Link -> ByteString
forall a. ToByteString a => a -> ByteString
toByteString'