@@ -71,6 +71,22 @@ class FromHttpApiData a where
71 parseQueryParam :: Text -> Either Text a
71 parseQueryParam :: Text -> Either Text a
72 parseQueryParam = parseUrlPiece
72 parseQueryParam = parseUrlPiece
74+-- | Convert multiple values to a list of URL pieces.
76+-- >>> toUrlPieces [1, 2, 3]
78+toUrlPieces :: (Functor t, ToHttpApiData a) => t a -> t Text
79+toUrlPieces = fmap toUrlPiece
81+-- | Parse multiple URL pieces.
83+-- >>> parseUrlPieces ["true", "false"] :: Either Text [Bool]
85+-- >>> parseUrlPieces ["123", "hello", "world"] :: Either Text [Int]
86+-- Left "input does not start with a digit"
87+parseUrlPieces :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a)
88+parseUrlPieces = traverse parseUrlPiece
74-- | Parse URL path piece in a @'Maybe'@.
90-- | Parse URL path piece in a @'Maybe'@.
76-- >>> parseUrlPieceMaybe "12" :: Maybe Int
92-- >>> parseUrlPieceMaybe "12" :: Maybe Int