-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Converting to/from HTTP API data like URL pieces, headers and query parameters.
--   
--   Please see README.md
@package http-api-data
@version 0.2.2


-- | Convert Haskell values to and from HTTP API data such as URL pieces,
--   headers and query parameters.
module Web.HttpApiData.Internal

-- | Convert value to HTTP API data.
class ToHttpApiData a where toUrlPiece = toQueryParam toHeader = encodeUtf8 . toUrlPiece toQueryParam = toUrlPiece

-- | Convert to URL path piece.
toUrlPiece :: ToHttpApiData a => a -> Text

-- | Convert to HTTP header value.
toHeader :: ToHttpApiData a => a -> ByteString

-- | Convert to query param value.
toQueryParam :: ToHttpApiData a => a -> Text

-- | Parse value from HTTP API data.
class FromHttpApiData a where parseUrlPiece = parseQueryParam parseHeader = parseUrlPiece . decodeUtf8 parseQueryParam = parseUrlPiece

-- | Parse URL path piece.
parseUrlPiece :: FromHttpApiData a => Text -> Either Text a

-- | Parse HTTP header value.
parseHeader :: FromHttpApiData a => ByteString -> Either Text a

-- | Parse query param value.
parseQueryParam :: FromHttpApiData a => Text -> Either Text a

-- | Convert multiple values to a list of URL pieces.
--   
--   <pre>
--   &gt;&gt;&gt; toUrlPieces [1, 2, 3]
--   ["1","2","3"]
--   </pre>
toUrlPieces :: (Functor t, ToHttpApiData a) => t a -> t Text

-- | Parse multiple URL pieces.
--   
--   <pre>
--   &gt;&gt;&gt; parseUrlPieces ["true", "false"] :: Either Text [Bool]
--   Right [True,False]
--   
--   &gt;&gt;&gt; parseUrlPieces ["123", "hello", "world"] :: Either Text [Int]
--   Left "could not parse: `hello' (input does not start with a digit)"
--   </pre>
parseUrlPieces :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a)

-- | Convert multiple values to a list of query parameter values.
--   
--   <pre>
--   &gt;&gt;&gt; toQueryParams [fromGregorian 2015 10 03, fromGregorian 2015 12 01]
--   ["2015-10-03","2015-12-01"]
--   </pre>
toQueryParams :: (Functor t, ToHttpApiData a) => t a -> t Text

-- | Parse multiple query parameters.
--   
--   <pre>
--   &gt;&gt;&gt; parseQueryParams ["1", "2", "3"] :: Either Text [Int]
--   Right [1,2,3]
--   
--   &gt;&gt;&gt; parseQueryParams ["64", "128", "256"] :: Either Text [Word8]
--   Left "out of bounds: `256' (should be between 0 and 255)"
--   </pre>
parseQueryParams :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a)

-- | Parse URL path piece in a <tt><a>Maybe</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseUrlPieceMaybe "12" :: Maybe Int
--   Just 12
--   </pre>
parseUrlPieceMaybe :: FromHttpApiData a => Text -> Maybe a

-- | Parse HTTP header value in a <tt><a>Maybe</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseHeaderMaybe "hello" :: Maybe Text
--   Just "hello"
--   </pre>
parseHeaderMaybe :: FromHttpApiData a => ByteString -> Maybe a

-- | Parse query param value in a <tt><a>Maybe</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseQueryParamMaybe "true" :: Maybe Bool
--   Just True
--   </pre>
parseQueryParamMaybe :: FromHttpApiData a => Text -> Maybe a

-- | Default parsing error.
defaultParseError :: Text -> Either Text a

-- | Convert <tt><a>Maybe</a></tt> parser into <tt><a>Either</a>
--   <a>Text</a></tt> parser with default error message.
parseMaybeTextData :: (Text -> Maybe a) -> (Text -> Either Text a)

-- | <i>Lower case</i>.
--   
--   Convert to URL piece using <tt><a>Show</a></tt> instance. The result
--   is always lower cased.
--   
--   <pre>
--   &gt;&gt;&gt; showTextData True
--   "true"
--   </pre>
--   
--   This can be used as a default implementation for enumeration types:
--   
--   <pre>
--   &gt;&gt;&gt; data MyData = Foo | Bar | Baz deriving (Show)
--   
--   &gt;&gt;&gt; instance ToHttpApiData MyData where toUrlPiece = showTextData
--   
--   &gt;&gt;&gt; toUrlPiece Foo
--   "foo"
--   </pre>
showTextData :: Show a => a -> Text

-- | Like <tt><a>show</a></tt>, but returns <tt><a>Text</a></tt>.
showt :: Show a => a -> Text

-- | <i>Case insensitive</i>.
--   
--   Parse given text case insensitive and then parse the rest of the input
--   using <tt><a>parseUrlPiece</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int
--   Right 10
--   
--   &gt;&gt;&gt; parseUrlPieceWithPrefix "Left " "left" :: Either Text Bool
--   Left "could not parse: `left'"
--   </pre>
--   
--   This can be used to implement <tt><a>FromHttpApiData</a></tt> for
--   single field constructors:
--   
--   <pre>
--   &gt;&gt;&gt; data Foo = Foo Int deriving (Show)
--   
--   &gt;&gt;&gt; instance FromHttpApiData Foo where parseUrlPiece s = Foo &lt;$&gt; parseUrlPieceWithPrefix "Foo " s
--   
--   &gt;&gt;&gt; parseUrlPiece "foo 1" :: Either Text Foo
--   Right (Foo 1)
--   </pre>
parseUrlPieceWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a

-- | Parse given bytestring then parse the rest of the input using
--   <tt><a>parseHeader</a></tt>.
--   
--   <pre>
--   data BasicAuthToken = BasicAuthToken Text deriving (Show)
--   
--   instance FromHttpApiData BasicAuthToken where
--     parseHeader h     = BasicAuthToken &lt;$&gt; parseHeaderWithPrefix "Basic " h
--     parseQueryParam p = BasicAuthToken &lt;$&gt; parseQueryParam p
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken
--   Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
--   </pre>
parseHeaderWithPrefix :: FromHttpApiData a => ByteString -> ByteString -> Either Text a

-- | <i>Case insensitive</i>.
--   
--   Parse given text case insensitive and then parse the rest of the input
--   using <tt><a>parseQueryParam</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseQueryParamWithPrefix "z" "z10" :: Either Text Int
--   Right 10
--   </pre>
parseQueryParamWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a

-- | <i>Case insensitive</i>.
--   
--   Parse values case insensitively based on <tt><a>Show</a></tt>
--   instance.
--   
--   <pre>
--   &gt;&gt;&gt; parseBoundedTextData "true" :: Either Text Bool
--   Right True
--   
--   &gt;&gt;&gt; parseBoundedTextData "FALSE" :: Either Text Bool
--   Right False
--   </pre>
--   
--   This can be used as a default implementation for enumeration types:
--   
--   <pre>
--   &gt;&gt;&gt; data MyData = Foo | Bar | Baz deriving (Show, Bounded, Enum)
--   
--   &gt;&gt;&gt; instance FromHttpApiData MyData where parseUrlPiece = parseBoundedTextData
--   
--   &gt;&gt;&gt; parseUrlPiece "foo" :: Either Text MyData
--   Right Foo
--   </pre>
parseBoundedTextData :: (Show a, Bounded a, Enum a) => Text -> Either Text a

-- | Parse URL piece using <tt><a>Read</a></tt> instance.
--   
--   Use for types which do not involve letters:
--   
--   <pre>
--   &gt;&gt;&gt; readTextData "1991-06-02" :: Either Text Day
--   Right 1991-06-02
--   </pre>
--   
--   This parser is case sensitive and will not match
--   <tt><a>showTextData</a></tt> in presense of letters:
--   
--   <pre>
--   &gt;&gt;&gt; readTextData (showTextData True) :: Either Text Bool
--   Left "could not parse: `true'"
--   </pre>
--   
--   See <tt><a>parseBoundedTextData</a></tt>.
readTextData :: Read a => Text -> Either Text a

-- | Run <tt><a>Reader</a></tt> as HTTP API data parser.
runReader :: Reader a -> Text -> Either Text a

-- | Run <tt><a>Reader</a></tt> to parse bounded integral value with bounds
--   checking.
--   
--   <pre>
--   &gt;&gt;&gt; parseBounded decimal "256" :: Either Text Word8
--   Left "out of bounds: `256' (should be between 0 and 255)"
--   </pre>
parseBounded :: (Bounded a, Integral a) => Reader Integer -> Text -> Either Text a

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece ()
--   "_"
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece (Version [1, 2, 3] [])
--   "1.2.3"
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece (fromGregorian 2015 10 03)
--   "2015-10-03"
--   </pre>
timeToUrlPiece :: FormatTime t => String -> t -> Text

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece $ LocalTime (fromGregorian 2015 10 03) (TimeOfDay 14 55 01)
--   "2015-10-03T14:55:01"
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece $ ZonedTime (LocalTime (fromGregorian 2015 10 03) (TimeOfDay 14 55 01)) utc
--   "2015-10-03T14:55:01+0000"
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece $ UTCTime (fromGregorian 2015 10 03) 864
--   "2015-10-03T00:14:24Z"
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece (Just "Hello")
--   "just Hello"
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; toUrlPiece (Left "err" :: Either String Int)
--   "left err"
--   
--   &gt;&gt;&gt; toUrlPiece (Right 3 :: Either String Int)
--   "right 3"
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; parseUrlPiece "_" :: Either Text ()
--   Right ()
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; showVersion &lt;$&gt; parseUrlPiece "1.2.3"
--   Right "1.2.3"
--   </pre>

-- | Parsing a <tt><a>Void</a></tt> value is always an error, considering
--   <tt><a>Void</a></tt> as a data type with no constructors.

-- | <pre>
--   &gt;&gt;&gt; toGregorian &lt;$&gt; parseUrlPiece "2016-12-01"
--   Right (2016,12,1)
--   </pre>
timeParseUrlPiece :: ParseTime t => String -> Text -> Either Text t

-- | <pre>
--   &gt;&gt;&gt; parseUrlPiece "2015-10-03T14:55:01" :: Either Text LocalTime
--   Right 2015-10-03 14:55:01
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; parseUrlPiece "2015-10-03T14:55:01+0000" :: Either Text ZonedTime
--   Right 2015-10-03 14:55:01 +0000
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; parseUrlPiece "2015-10-03T00:14:24Z" :: Either Text UTCTime
--   Right 2015-10-03 00:14:24 UTC
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; parseUrlPiece "Just 123" :: Either Text (Maybe Int)
--   Right (Just 123)
--   </pre>

-- | <pre>
--   &gt;&gt;&gt; parseUrlPiece "Right 123" :: Either Text (Either String Int)
--   Right (Right 123)
--   </pre>
instance Web.HttpApiData.Internal.ToHttpApiData ()
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Types.Char
instance Web.HttpApiData.Internal.ToHttpApiData Data.Version.Version
instance Web.HttpApiData.Internal.ToHttpApiData Data.Void.Void
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Types.Bool
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Types.Ordering
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Types.Double
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Types.Float
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Types.Int
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Int.Int8
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Int.Int16
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Int.Int32
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Int.Int64
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Integer.Type.Integer
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Types.Word
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Word.Word8
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Word.Word16
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Word.Word32
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Word.Word64
instance Web.HttpApiData.Internal.ToHttpApiData Data.Time.Calendar.Days.Day
instance Web.HttpApiData.Internal.ToHttpApiData Data.Time.LocalTime.LocalTime.LocalTime
instance Web.HttpApiData.Internal.ToHttpApiData Data.Time.LocalTime.LocalTime.ZonedTime
instance Web.HttpApiData.Internal.ToHttpApiData Data.Time.Clock.UTC.UTCTime
instance Web.HttpApiData.Internal.ToHttpApiData Data.Time.Clock.UTC.NominalDiffTime
instance Web.HttpApiData.Internal.ToHttpApiData GHC.Base.String
instance Web.HttpApiData.Internal.ToHttpApiData Data.Text.Internal.Text
instance Web.HttpApiData.Internal.ToHttpApiData Data.Text.Internal.Lazy.Text
instance Web.HttpApiData.Internal.ToHttpApiData Data.Monoid.All
instance Web.HttpApiData.Internal.ToHttpApiData Data.Monoid.Any
instance Web.HttpApiData.Internal.ToHttpApiData a => Web.HttpApiData.Internal.ToHttpApiData (Data.Monoid.Dual a)
instance Web.HttpApiData.Internal.ToHttpApiData a => Web.HttpApiData.Internal.ToHttpApiData (Data.Monoid.Sum a)
instance Web.HttpApiData.Internal.ToHttpApiData a => Web.HttpApiData.Internal.ToHttpApiData (Data.Monoid.Product a)
instance Web.HttpApiData.Internal.ToHttpApiData a => Web.HttpApiData.Internal.ToHttpApiData (Data.Monoid.First a)
instance Web.HttpApiData.Internal.ToHttpApiData a => Web.HttpApiData.Internal.ToHttpApiData (Data.Monoid.Last a)
instance Web.HttpApiData.Internal.ToHttpApiData a => Web.HttpApiData.Internal.ToHttpApiData (GHC.Base.Maybe a)
instance (Web.HttpApiData.Internal.ToHttpApiData a, Web.HttpApiData.Internal.ToHttpApiData b) => Web.HttpApiData.Internal.ToHttpApiData (Data.Either.Either a b)
instance Web.HttpApiData.Internal.FromHttpApiData ()
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Types.Char
instance Web.HttpApiData.Internal.FromHttpApiData Data.Version.Version
instance Web.HttpApiData.Internal.FromHttpApiData Data.Void.Void
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Types.Bool
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Types.Ordering
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Types.Double
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Types.Float
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Types.Int
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Int.Int8
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Int.Int16
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Int.Int32
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Int.Int64
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Integer.Type.Integer
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Types.Word
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Word.Word8
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Word.Word16
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Word.Word32
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Word.Word64
instance Web.HttpApiData.Internal.FromHttpApiData GHC.Base.String
instance Web.HttpApiData.Internal.FromHttpApiData Data.Text.Internal.Text
instance Web.HttpApiData.Internal.FromHttpApiData Data.Text.Internal.Lazy.Text
instance Web.HttpApiData.Internal.FromHttpApiData Data.Time.Calendar.Days.Day
instance Web.HttpApiData.Internal.FromHttpApiData Data.Time.LocalTime.LocalTime.LocalTime
instance Web.HttpApiData.Internal.FromHttpApiData Data.Time.LocalTime.LocalTime.ZonedTime
instance Web.HttpApiData.Internal.FromHttpApiData Data.Time.Clock.UTC.UTCTime
instance Web.HttpApiData.Internal.FromHttpApiData Data.Time.Clock.UTC.NominalDiffTime
instance Web.HttpApiData.Internal.FromHttpApiData Data.Monoid.All
instance Web.HttpApiData.Internal.FromHttpApiData Data.Monoid.Any
instance Web.HttpApiData.Internal.FromHttpApiData a => Web.HttpApiData.Internal.FromHttpApiData (Data.Monoid.Dual a)
instance Web.HttpApiData.Internal.FromHttpApiData a => Web.HttpApiData.Internal.FromHttpApiData (Data.Monoid.Sum a)
instance Web.HttpApiData.Internal.FromHttpApiData a => Web.HttpApiData.Internal.FromHttpApiData (Data.Monoid.Product a)
instance Web.HttpApiData.Internal.FromHttpApiData a => Web.HttpApiData.Internal.FromHttpApiData (Data.Monoid.First a)
instance Web.HttpApiData.Internal.FromHttpApiData a => Web.HttpApiData.Internal.FromHttpApiData (Data.Monoid.Last a)
instance Web.HttpApiData.Internal.FromHttpApiData a => Web.HttpApiData.Internal.FromHttpApiData (GHC.Base.Maybe a)
instance (Web.HttpApiData.Internal.FromHttpApiData a, Web.HttpApiData.Internal.FromHttpApiData b) => Web.HttpApiData.Internal.FromHttpApiData (Data.Either.Either a b)


-- | Convert Haskell values to and from HTTP API data such as URL pieces,
--   headers and query parameters.
module Web.HttpApiData

-- | Convert value to HTTP API data.
class ToHttpApiData a where toUrlPiece = toQueryParam toHeader = encodeUtf8 . toUrlPiece toQueryParam = toUrlPiece

-- | Convert to URL path piece.
toUrlPiece :: ToHttpApiData a => a -> Text

-- | Convert to HTTP header value.
toHeader :: ToHttpApiData a => a -> ByteString

-- | Convert to query param value.
toQueryParam :: ToHttpApiData a => a -> Text

-- | Parse value from HTTP API data.
class FromHttpApiData a where parseUrlPiece = parseQueryParam parseHeader = parseUrlPiece . decodeUtf8 parseQueryParam = parseUrlPiece

-- | Parse URL path piece.
parseUrlPiece :: FromHttpApiData a => Text -> Either Text a

-- | Parse HTTP header value.
parseHeader :: FromHttpApiData a => ByteString -> Either Text a

-- | Parse query param value.
parseQueryParam :: FromHttpApiData a => Text -> Either Text a

-- | Parse URL path piece in a <tt><a>Maybe</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseUrlPieceMaybe "12" :: Maybe Int
--   Just 12
--   </pre>
parseUrlPieceMaybe :: FromHttpApiData a => Text -> Maybe a

-- | Parse HTTP header value in a <tt><a>Maybe</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseHeaderMaybe "hello" :: Maybe Text
--   Just "hello"
--   </pre>
parseHeaderMaybe :: FromHttpApiData a => ByteString -> Maybe a

-- | Parse query param value in a <tt><a>Maybe</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseQueryParamMaybe "true" :: Maybe Bool
--   Just True
--   </pre>
parseQueryParamMaybe :: FromHttpApiData a => Text -> Maybe a

-- | <i>Case insensitive</i>.
--   
--   Parse given text case insensitive and then parse the rest of the input
--   using <tt><a>parseUrlPiece</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int
--   Right 10
--   
--   &gt;&gt;&gt; parseUrlPieceWithPrefix "Left " "left" :: Either Text Bool
--   Left "could not parse: `left'"
--   </pre>
--   
--   This can be used to implement <tt><a>FromHttpApiData</a></tt> for
--   single field constructors:
--   
--   <pre>
--   &gt;&gt;&gt; data Foo = Foo Int deriving (Show)
--   
--   &gt;&gt;&gt; instance FromHttpApiData Foo where parseUrlPiece s = Foo &lt;$&gt; parseUrlPieceWithPrefix "Foo " s
--   
--   &gt;&gt;&gt; parseUrlPiece "foo 1" :: Either Text Foo
--   Right (Foo 1)
--   </pre>
parseUrlPieceWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a

-- | Parse given bytestring then parse the rest of the input using
--   <tt><a>parseHeader</a></tt>.
--   
--   <pre>
--   data BasicAuthToken = BasicAuthToken Text deriving (Show)
--   
--   instance FromHttpApiData BasicAuthToken where
--     parseHeader h     = BasicAuthToken &lt;$&gt; parseHeaderWithPrefix "Basic " h
--     parseQueryParam p = BasicAuthToken &lt;$&gt; parseQueryParam p
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken
--   Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
--   </pre>
parseHeaderWithPrefix :: FromHttpApiData a => ByteString -> ByteString -> Either Text a

-- | <i>Case insensitive</i>.
--   
--   Parse given text case insensitive and then parse the rest of the input
--   using <tt><a>parseQueryParam</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; parseQueryParamWithPrefix "z" "z10" :: Either Text Int
--   Right 10
--   </pre>
parseQueryParamWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a

-- | Convert multiple values to a list of URL pieces.
--   
--   <pre>
--   &gt;&gt;&gt; toUrlPieces [1, 2, 3]
--   ["1","2","3"]
--   </pre>
toUrlPieces :: (Functor t, ToHttpApiData a) => t a -> t Text

-- | Parse multiple URL pieces.
--   
--   <pre>
--   &gt;&gt;&gt; parseUrlPieces ["true", "false"] :: Either Text [Bool]
--   Right [True,False]
--   
--   &gt;&gt;&gt; parseUrlPieces ["123", "hello", "world"] :: Either Text [Int]
--   Left "could not parse: `hello' (input does not start with a digit)"
--   </pre>
parseUrlPieces :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a)

-- | Convert multiple values to a list of query parameter values.
--   
--   <pre>
--   &gt;&gt;&gt; toQueryParams [fromGregorian 2015 10 03, fromGregorian 2015 12 01]
--   ["2015-10-03","2015-12-01"]
--   </pre>
toQueryParams :: (Functor t, ToHttpApiData a) => t a -> t Text

-- | Parse multiple query parameters.
--   
--   <pre>
--   &gt;&gt;&gt; parseQueryParams ["1", "2", "3"] :: Either Text [Int]
--   Right [1,2,3]
--   
--   &gt;&gt;&gt; parseQueryParams ["64", "128", "256"] :: Either Text [Word8]
--   Left "out of bounds: `256' (should be between 0 and 255)"
--   </pre>
parseQueryParams :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a)

-- | <i>Lower case</i>.
--   
--   Convert to URL piece using <tt><a>Show</a></tt> instance. The result
--   is always lower cased.
--   
--   <pre>
--   &gt;&gt;&gt; showTextData True
--   "true"
--   </pre>
--   
--   This can be used as a default implementation for enumeration types:
--   
--   <pre>
--   &gt;&gt;&gt; data MyData = Foo | Bar | Baz deriving (Show)
--   
--   &gt;&gt;&gt; instance ToHttpApiData MyData where toUrlPiece = showTextData
--   
--   &gt;&gt;&gt; toUrlPiece Foo
--   "foo"
--   </pre>
showTextData :: Show a => a -> Text

-- | Parse URL piece using <tt><a>Read</a></tt> instance.
--   
--   Use for types which do not involve letters:
--   
--   <pre>
--   &gt;&gt;&gt; readTextData "1991-06-02" :: Either Text Day
--   Right 1991-06-02
--   </pre>
--   
--   This parser is case sensitive and will not match
--   <tt><a>showTextData</a></tt> in presense of letters:
--   
--   <pre>
--   &gt;&gt;&gt; readTextData (showTextData True) :: Either Text Bool
--   Left "could not parse: `true'"
--   </pre>
--   
--   See <tt><a>parseBoundedTextData</a></tt>.
readTextData :: Read a => Text -> Either Text a

-- | <i>Case insensitive</i>.
--   
--   Parse values case insensitively based on <tt><a>Show</a></tt>
--   instance.
--   
--   <pre>
--   &gt;&gt;&gt; parseBoundedTextData "true" :: Either Text Bool
--   Right True
--   
--   &gt;&gt;&gt; parseBoundedTextData "FALSE" :: Either Text Bool
--   Right False
--   </pre>
--   
--   This can be used as a default implementation for enumeration types:
--   
--   <pre>
--   &gt;&gt;&gt; data MyData = Foo | Bar | Baz deriving (Show, Bounded, Enum)
--   
--   &gt;&gt;&gt; instance FromHttpApiData MyData where parseUrlPiece = parseBoundedTextData
--   
--   &gt;&gt;&gt; parseUrlPiece "foo" :: Either Text MyData
--   Right Foo
--   </pre>
parseBoundedTextData :: (Show a, Bounded a, Enum a) => Text -> Either Text a
