@@ -53,17 +53,26 @@ showDoc ist d
53 | otherwise = text " -- " <>
53 | otherwise = text " -- " <>
54 renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) d
54 renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) d
56−pprintFD :: IState -> FunDoc -> Doc OutputAnnotation
56+pprintFD :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
57−pprintFD ist (FD n doc args ty f)
57+pprintFD ist totalityFlag (FD n doc args ty f)
58 = nest 4 (prettyName True (ppopt_impl ppo) [] n <+> colon <+>
58 = nest 4 (prettyName True (ppopt_impl ppo) [] n <+> colon <+>
59 pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
59 pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
60 , not (T.isPrefixOf (T.pack "__") n') ] infixes ty <$>
60 , not (T.isPrefixOf (T.pack "__") n') ] infixes ty <$>
61 renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) doc <$>
62 renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) doc <$>
62 maybe empty (\f -> text (show f) <> line) f <>
64 maybe empty (\f -> text (show f) <> line) f <>
65+ -- show arguments doc
63 let argshow = showArgs args [] in
66 let argshow = showArgs args [] in
64− if not (null argshow)
67+ (if not (null argshow)
65 then nest 4 $ text "Arguments:" <$> vsep argshow
68 then nest 4 $ text "Arguments:" <$> vsep argshow
66− else empty)
69+ else empty) <>
70+ -- show totality status
71+ let totality = getTotality in
72+ (if totalityFlag && not (null totality) then
73+ line <> (vsep . map (\t -> text "The function is" <+> t) $ totality)
68 where ppo = ppOptionIst ist
77 where ppo = ppOptionIst ist
69 infixes = idris_infixes ist
78 infixes = idris_infixes ist
@@ -87,15 +96,21 @@ pprintFD ist (FD n doc args ty f)
87 showArgs args ((n, True):bnd)
96 showArgs args ((n, True):bnd)
88 showArgs ((n, _, _, _):args) bnd = showArgs args ((n, True):bnd)
97 showArgs ((n, _, _, _):args) bnd = showArgs args ((n, True):bnd)
89 showArgs [] _ = []
98 showArgs [] _ = []
99+ getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist)
101+pprintFDWithTotality :: IState -> FunDoc -> Doc OutputAnnotation
102+pprintFDWithTotality ist = pprintFD ist True
104+pprintFDWithoutTotality :: IState -> FunDoc -> Doc OutputAnnotation
105+pprintFDWithoutTotality ist = pprintFD ist False
92pprintDocs :: IState -> Docs -> Doc OutputAnnotation
107pprintDocs :: IState -> Docs -> Doc OutputAnnotation
93−pprintDocs ist (FunDoc d) = pprintFD ist d
108+pprintDocs ist (FunDoc d) = pprintFDWithTotality ist d
94pprintDocs ist (DataDoc t args)
109pprintDocs ist (DataDoc t args)
95− = text "Data type" <+> pprintFD ist t <$>
110+ = text "Data type" <+> pprintFDWithoutTotality ist t <$>
96 if null args then text "No constructors."
111 if null args then text "No constructors."
97 else nest 4 (text "Constructors:" <> line <>
112 else nest 4 (text "Constructors:" <> line <>
98− vsep (map (pprintFD ist) args))
113+ vsep (map (pprintFDWithoutTotality ist) args))
99pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ctor)
114pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ctor)
100 = nest 4 (text "Type class" <+> prettyName True (ppopt_impl ppo) [] n <>
115 = nest 4 (text "Type class" <+> prettyName True (ppopt_impl ppo) [] n <>
101 if nullDocstring doc
116 if nullDocstring doc
@@ -105,12 +120,12 @@ pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ct
105 nest 4 (text "Parameters:" <$> prettyParameters)
120 nest 4 (text "Parameters:" <$> prettyParameters)
106 <> line <$>
121 <> line <$>
107 nest 4 (text "Methods:" <$>
122 nest 4 (text "Methods:" <$>
108− vsep (map (pprintFD ist) meths))
123+ vsep (map (pprintFDWithTotality ist) meths))
110 maybe empty
125 maybe empty
111 ((<> line) . nest 4 .
126 ((<> line) . nest 4 .
112 (text "Instance constructor:" <$>) .
127 (text "Instance constructor:" <$>) .
113− pprintFD ist)
128+ pprintFDWithoutTotality ist)
116 nest 4 (text "Instances:" <$>
131 nest 4 (text "Instances:" <$>
@@ -195,7 +210,7 @@ pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ct
195 else hsep (punctuate comma (map (prettyName True False params' . fst) params))
210 else hsep (punctuate comma (map (prettyName True False params' . fst) params))
197pprintDocs ist (NamedInstanceDoc _cls doc)
212pprintDocs ist (NamedInstanceDoc _cls doc)
198− = nest 4 (text "Named instance:" <$> pprintFD ist doc)
213+ = nest 4 (text "Named instance:" <$> pprintFDWithoutTotality ist doc)
200pprintDocs ist (ModDoc mod docs)
215pprintDocs ist (ModDoc mod docs)
201 = nest 4 $ text "Module" <+> text (concat (intersperse "." mod)) <> colon <$>
216 = nest 4 $ text "Module" <+> text (concat (intersperse "." mod)) <> colon <$>