git.iko.soy/typeable/servant
on master help sign in
removed Servant.Docs.printMarkdown
102c752Sönke Hahn
example/greet.hs+1−1
@@ -102,4 +102,4 @@ main = do
102 print =<< runEitherT (deleteGreet "blah" uri)
102 print =<< runEitherT (deleteGreet "blah" uri)
103 killThread tid
103 killThread tid
104 putStrLn "\n---------\n"
104 putStrLn "\n---------\n"
105− printMarkdown docsGreet
105+ putStrLn $ markdown docsGreet
src/Servant/Docs.hs+8−11
@@ -16,13 +16,13 @@
16--
16--
17-- @docs :: 'HasDocs' api => 'Proxy' api -> 'API'@
17-- @docs :: 'HasDocs' api => 'Proxy' api -> 'API'@
18--
18--
19−-- You can then call 'printMarkdown' on it:
19+-- You can then call 'markdown' on it:
20--
20--
21−-- @printMarkdown :: 'API' -> IO ()@
21+-- @printMarkdown :: 'API' -> String@
22--
22--
23-- or define a custom pretty printer:
23-- or define a custom pretty printer:
24--
24--
25−-- @yourPrettyDocs :: 'API' -> IO () -- or blaze-html's HTML, or ...@
25+-- @yourPrettyDocs :: 'API' -> String -- or blaze-html's HTML, or ...@
26--
26--
27-- The only thing you'll need to do will be to implement some classes
27-- The only thing you'll need to do will be to implement some classes
28-- for your captures, get parameters and request or response bodies.
28-- for your captures, get parameters and request or response bodies.
@@ -70,7 +70,7 @@
70-- > toCapture _ = DocCapture "greetid" "identifier of the greet msg to remove"
70-- > toCapture _ = DocCapture "greetid" "identifier of the greet msg to remove"
71-- >
71-- >
72-- > -- API specification
72-- > -- API specification
73−-- > type TestApi =
73+-- > type TestApi =
74-- > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
74-- > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
75-- > :<|> "greet" :> RQBody Greet :> Post Greet
75-- > :<|> "greet" :> RQBody Greet :> Post Greet
76-- > :<|> "delete" :> Capture "greetid" Text :> Delete
76-- > :<|> "delete" :> Capture "greetid" Text :> Delete
@@ -83,10 +83,10 @@
83-- > greetDocs = docs testApi
83-- > greetDocs = docs testApi
84-- >
84-- >
85-- > main :: IO ()
85-- > main :: IO ()
86−-- > main = printMarkdown greetDocs
86+-- > main = putStrLn $ markdown greetDocs
87module Servant.Docs
87module Servant.Docs
88 ( -- * 'HasDocs' class and key functions
88 ( -- * 'HasDocs' class and key functions
89− HasDocs(..), docs, markdown, printMarkdown
89+ HasDocs(..), docs, markdown
90
90
91 , -- * Classes you need to implement for your types
91 , -- * Classes you need to implement for your types
92 ToSample(..)
92 ToSample(..)
@@ -355,11 +355,8 @@ class ToParam t where
355class ToCapture c where
355class ToCapture c where
356 toCapture :: Proxy c -> DocCapture
356 toCapture :: Proxy c -> DocCapture
357
357
358−-- | Print documentation in Markdown format for
358+-- | Generate documentation in Markdown format for
359−-- the given 'API', on standard output.
359+-- the given 'API'.
360−printMarkdown :: API -> IO ()
361−printMarkdown = print . markdown
362−
363markdown :: API -> String
360markdown :: API -> String
364markdown = unlines . concat . map (uncurry printEndpoint) . HM.toList
361markdown = unlines . concat . map (uncurry printEndpoint) . HM.toList
365
362