on master help sign in
Merge pull request #1206 from paulkoerbitz/fix/1187-doc-no-constructors

Make ':doc' say 'No constructors.' when a data type has no constructors.

commit1e59cbd1c64f8826f82aeb829999fe9619b7603a authorDavid Christiansen <david@davidchristiansen.dk> dateTue 6 May 2014, 23:01 (12 years ago) parent45e0a6bf1d8f86
1 file changed+3−2
src/Idris/Docs.hs+3−2
src/Idris/Docs.hs+3−2
@@ -74,8 +74,9 @@ pprintDocs :: IState -> Docs -> Doc OutputAnnotation
7474pprintDocs ist (FunDoc d) = pprintFD ist d
7575pprintDocs ist (DataDoc t args)
7676 = text "Data type" <+> pprintFD ist t <$>
77− nest 4 (text "Constructors:" <> line <>
78− vsep (map (pprintFD ist) args))
77+ if null args then text "No constructors."
78+ else nest 4 (text "Constructors:" <> line <>
79+ vsep (map (pprintFD ist) args))
7980pprintDocs ist (ClassDoc n doc meths params instances)
8081 = nest 4 (text "Type class" <+> prettyName (ppopt_impl ppo) [] n <>
8182 if nullDocstring doc then empty else line <> renderDocstring doc)