on master help sign in
Careful when to show namespaces in :doc

Not relevant in methods, relevant in data types and records, relevant for named instances.

commit6e7f896c22d50db568b48ebce36ee3dc3658c6f8 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateWed 1 Jul 2015, 23:34 (11 years ago) parent09d107a
5 files changed+22−22
src/Idris/Docs.hs+11−11 test/docs003/expected+2−2 test/docs004/expected+3−3 test/idrisdoc009/expected+1−1 test/interactive005/expected+5−5
src/Idris/Docs.hs+11−11
@@ -53,9 +53,9 @@ showDoc ist d
5353 | otherwise = text " -- " <>
5454 renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) d
5555
56−pprintFD :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
57−pprintFD ist totalityFlag (FD n doc args ty f)
58− = nest 4 (prettyName True True [] n <+> colon <+>
56+pprintFD :: IState -> Bool -> Bool -> FunDoc -> Doc OutputAnnotation
57+pprintFD ist totalityFlag nsFlag (FD n doc args ty f)
58+ = nest 4 (prettyName True nsFlag [] n <+> colon <+>
5959 pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
6060 , not (T.isPrefixOf (T.pack "__") n') ] infixes ty <$>
6161 -- show doc
@@ -98,19 +98,19 @@ pprintFD ist totalityFlag (FD n doc args ty f)
9898 showArgs [] _ = []
9999 getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist)
100100
101−pprintFDWithTotality :: IState -> FunDoc -> Doc OutputAnnotation
101+pprintFDWithTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
102102pprintFDWithTotality ist = pprintFD ist True
103103
104−pprintFDWithoutTotality :: IState -> FunDoc -> Doc OutputAnnotation
104+pprintFDWithoutTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
105105pprintFDWithoutTotality ist = pprintFD ist False
106106
107107pprintDocs :: IState -> Docs -> Doc OutputAnnotation
108−pprintDocs ist (FunDoc d) = pprintFDWithTotality ist d
108+pprintDocs ist (FunDoc d) = pprintFDWithTotality ist True d
109109pprintDocs ist (DataDoc t args)
110− = text "Data type" <+> pprintFDWithoutTotality ist t <$>
110+ = text "Data type" <+> pprintFDWithoutTotality ist True t <$>
111111 if null args then text "No constructors."
112112 else nest 4 (text "Constructors:" <> line <>
113− vsep (map (pprintFDWithoutTotality ist) args))
113+ vsep (map (pprintFDWithoutTotality ist False) args))
114114pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ctor)
115115 = nest 4 (text "Type class" <+> prettyName True (ppopt_impl ppo) [] n <>
116116 if nullDocstring doc
@@ -120,12 +120,12 @@ pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ct
120120 nest 4 (text "Parameters:" <$> prettyParameters)
121121 <> line <$>
122122 nest 4 (text "Methods:" <$>
123− vsep (map (pprintFDWithTotality ist) meths))
123+ vsep (map (pprintFDWithTotality ist False) meths))
124124 <$>
125125 maybe empty
126126 ((<> line) . nest 4 .
127127 (text "Instance constructor:" <$>) .
128− pprintFDWithoutTotality ist)
128+ pprintFDWithoutTotality ist False)
129129 ctor
130130 <>
131131 nest 4 (text "Instances:" <$>
@@ -210,7 +210,7 @@ pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ct
210210 else hsep (punctuate comma (map (prettyName True False params' . fst) params))
211211
212212pprintDocs ist (NamedInstanceDoc _cls doc)
213− = nest 4 (text "Named instance:" <$> pprintFDWithoutTotality ist doc)
213+ = nest 4 (text "Named instance:" <$> pprintFDWithoutTotality ist True doc)
214214
215215pprintDocs ist (ModDoc mod docs)
216216 = nest 4 $ text "Module" <+> text (concat (intersperse "." mod)) <> colon <$>
test/docs003/expected+2−2
@@ -28,10 +28,10 @@ Subclasses:
2828 Traversable f
2929 Applicative f
3030Named instance:
31− mine : Functor List
31+ docs003.mine : Functor List
3232
3333
3434Named instance:
35− another : Functor List
35+ docs003.another : Functor List
3636 More functors!
3737
test/docs004/expected+3−3
@@ -1,4 +1,4 @@
1−MkFoo : (bar : Nat) -> (baz : Bool) -> Foo a
1+Main.MkFoo : (bar : Nat) -> (baz : Bool) -> Foo a
22 Constructor for Foo
33 Arguments:
44 (implicit) a : Type -- a type
@@ -8,11 +8,11 @@ MkFoo : (bar : Nat) -> (baz : Bool) -> Foo a
88 baz : Bool -- A field baz
99
1010 The function is Total
11−bar : (rec : Foo a) -> Nat
11+Main.Foo.bar : (rec : Foo a) -> Nat
1212 A field bar
1313
1414 The function is Total
15−baz : (rec : Foo a) -> Bool
15+Main.Foo.baz : (rec : Foo a) -> Bool
1616 A field baz
1717
1818 The function is Total
test/idrisdoc009/expected+1−1
@@ -1,4 +1,4 @@
1−Data type Test : Type
1+Data type Test.Test : Type
22 Docs for datatype Test.
33
44Constructors:
test/interactive005/expected+5−5
@@ -1,14 +1,14 @@
113 : Nat
22Hello, World
3−main : IO ()
3+Main.main : IO ()
44 This is a docstring
55
66 The function is Total
77Main.main is Total
88Hello, World
9−Prelude.Basics.id : a -> a
9+id : a -> a
1010Prelude.Basics.id : {a : Type} -> (__pi_arg : a) -> a
11−Prelude.Basics.id : a -> a
11+id : a -> a
1212
1313 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
1414 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -22,13 +22,13 @@ Prelude.Basics.id : a -> a
2222 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
2323 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424
25−main : IO ()
25+Main.main : IO ()
2626 This
2727 is a
2828 docstring
2929
3030 The function is Total
31−main : IO ()
31+Main.main : IO ()
3232 This is a docstring
3333
3434 The function is Total