git.iko.soy/typeable/http-api-data
on master help sign in
Try fix doctests
4fab672Nickolay Kudasov
Web/HttpApiData/Internal.hs+10−5
@@ -171,14 +171,19 @@ parseUrlPieceWithPrefix pattern input
171 where
171 where
172 (prefix, rest) = T.splitAt (T.length pattern) input
172 (prefix, rest) = T.splitAt (T.length pattern) input
173
173
174+-- $setup
175+-- >>> data BasicAuthToken = BasicAuthToken Text deriving (Show)
176+-- >>> instance FromHttpApiData BasicAuthToken where parseHeader h = BasicAuthToken <$> parseHeaderWithPrefix "Basic " h; parseQueryParam p = BasicAuthToken <$> parseQueryParam p
177+
174-- | Parse given bytestring then parse the rest of the input using @'parseHeader'@.
178-- | Parse given bytestring then parse the rest of the input using @'parseHeader'@.
175--
179--
180+-- @
176−-- >>> data BasicAuthToken = BasicAuthToken Text deriving (Show)
181+-- data BasicAuthToken = BasicAuthToken Text deriving (Show)
177−-- >>> :{
182+--
178-- instance FromHttpApiData BasicAuthToken where
183-- instance FromHttpApiData BasicAuthToken where
179−-- parseHeader h = BasicAuthToken <$> parseHeaderWithPrefix "Basic " h
184+-- parseHeader h = BasicAuthToken \<$\> parseHeaderWithPrefix "Basic " h
180−-- parseQueryParam p = BasicAuthToken <$> parseQueryParam p
185+-- parseQueryParam p = BasicAuthToken \<$\> parseQueryParam p
181−-- :}
186+-- @
182--
187--
183-- >>> parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken
188-- >>> parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken
184-- Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
189-- Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")