git.iko.soy/typeable/http-api-data
on master help sign in
Try fix doctests

Doctest runs its tests in GHCi, but older versions of GHC do not handle multiline instance declaration for some reason.

commit4fab672bbafb0ef0ec461cac7ae4dd2a05b94b80 authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateSun 11 Oct 2015, 16:34 (11 years ago) parentf918e5b
1 file changed+10−5
Web/HttpApiData/Internal.hs+10−5
Web/HttpApiData/Internal.hs+10−5
@@ -171,14 +171,19 @@ parseUrlPieceWithPrefix pattern input
171171 where
172172 (prefix, rest) = T.splitAt (T.length pattern) input
173173
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+
174178-- | Parse given bytestring then parse the rest of the input using @'parseHeader'@.
175179--
176−-- >>> data BasicAuthToken = BasicAuthToken Text deriving (Show)
177−-- >>> :{
180+-- @
181+-- data BasicAuthToken = BasicAuthToken Text deriving (Show)
182+--
178183-- instance FromHttpApiData BasicAuthToken where
179−-- parseHeader h = BasicAuthToken <$> parseHeaderWithPrefix "Basic " h
180−-- parseQueryParam p = BasicAuthToken <$> parseQueryParam p
181−-- :}
184+-- parseHeader h = BasicAuthToken \<$\> parseHeaderWithPrefix "Basic " h
185+-- parseQueryParam p = BasicAuthToken \<$\> parseQueryParam p
186+-- @
182187--
183188-- >>> parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken
184189-- Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")