on master help sign in
Careful when to show namespaces in :doc
6e7f896Edwin Brady
src/Idris/Docs.hs+11−11
@@ -53,9 +53,9 @@ 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
55
55
56−pprintFD :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
56+pprintFD :: IState -> Bool -> Bool -> FunDoc -> Doc OutputAnnotation
57−pprintFD ist totalityFlag (FD n doc args ty f)
57+pprintFD ist totalityFlag nsFlag (FD n doc args ty f)
58− = nest 4 (prettyName True True [] n <+> colon <+>
58+ = nest 4 (prettyName True nsFlag [] 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 -- show doc
61 -- show doc
@@ -98,19 +98,19 @@ pprintFD ist totalityFlag (FD n doc args ty f)
98 showArgs [] _ = []
98 showArgs [] _ = []
99 getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist)
99 getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist)
100
100
101−pprintFDWithTotality :: IState -> FunDoc -> Doc OutputAnnotation
101+pprintFDWithTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
102pprintFDWithTotality ist = pprintFD ist True
102pprintFDWithTotality ist = pprintFD ist True
103
103
104−pprintFDWithoutTotality :: IState -> FunDoc -> Doc OutputAnnotation
104+pprintFDWithoutTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
105pprintFDWithoutTotality ist = pprintFD ist False
105pprintFDWithoutTotality ist = pprintFD ist False
106
106
107pprintDocs :: IState -> Docs -> Doc OutputAnnotation
107pprintDocs :: IState -> Docs -> Doc OutputAnnotation
108−pprintDocs ist (FunDoc d) = pprintFDWithTotality ist d
108+pprintDocs ist (FunDoc d) = pprintFDWithTotality ist True d
109pprintDocs ist (DataDoc t args)
109pprintDocs ist (DataDoc t args)
110− = text "Data type" <+> pprintFDWithoutTotality ist t <$>
110+ = text "Data type" <+> pprintFDWithoutTotality ist True t <$>
111 if null args then text "No constructors."
111 if null args then text "No constructors."
112 else nest 4 (text "Constructors:" <> line <>
112 else nest 4 (text "Constructors:" <> line <>
113− vsep (map (pprintFDWithoutTotality ist) args))
113+ vsep (map (pprintFDWithoutTotality ist False) args))
114pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ctor)
114pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ctor)
115 = nest 4 (text "Type class" <+> prettyName True (ppopt_impl ppo) [] n <>
115 = nest 4 (text "Type class" <+> prettyName True (ppopt_impl ppo) [] n <>
116 if nullDocstring doc
116 if nullDocstring doc
@@ -120,12 +120,12 @@ pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ct
120 nest 4 (text "Parameters:" <$> prettyParameters)
120 nest 4 (text "Parameters:" <$> prettyParameters)
121 <> line <$>
121 <> line <$>
122 nest 4 (text "Methods:" <$>
122 nest 4 (text "Methods:" <$>
123− vsep (map (pprintFDWithTotality ist) meths))
123+ vsep (map (pprintFDWithTotality ist False) meths))
124 <$>
124 <$>
125 maybe empty
125 maybe empty
126 ((<> line) . nest 4 .
126 ((<> line) . nest 4 .
127 (text "Instance constructor:" <$>) .
127 (text "Instance constructor:" <$>) .
128− pprintFDWithoutTotality ist)
128+ pprintFDWithoutTotality ist False)
129 ctor
129 ctor
130 <>
130 <>
131 nest 4 (text "Instances:" <$>
131 nest 4 (text "Instances:" <$>
@@ -210,7 +210,7 @@ pprintDocs ist (ClassDoc n doc meths params instances subclasses superclasses ct
210 else hsep (punctuate comma (map (prettyName True False params' . fst) params))
210 else hsep (punctuate comma (map (prettyName True False params' . fst) params))
211
211
212pprintDocs ist (NamedInstanceDoc _cls doc)
212pprintDocs ist (NamedInstanceDoc _cls doc)
213− = nest 4 (text "Named instance:" <$> pprintFDWithoutTotality ist doc)
213+ = nest 4 (text "Named instance:" <$> pprintFDWithoutTotality ist True doc)
214
214
215pprintDocs ist (ModDoc mod docs)
215pprintDocs ist (ModDoc mod docs)
216 = nest 4 $ text "Module" <+> text (concat (intersperse "." mod)) <> colon <$>
216 = nest 4 $ text "Module" <+> text (concat (intersperse "." mod)) <> colon <$>
test/docs003/expected+2−2
@@ -28,10 +28,10 @@ Subclasses:
28 Traversable f
28 Traversable f
29 Applicative f
29 Applicative f
30Named instance:
30Named instance:
31− mine : Functor List
31+ docs003.mine : Functor List
32
32
33
33
34Named instance:
34Named instance:
35− another : Functor List
35+ docs003.another : Functor List
36 More functors!
36 More functors!
37
37
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
2 Constructor for Foo
2 Constructor for Foo
3 Arguments:
3 Arguments:
4 (implicit) a : Type -- a type
4 (implicit) a : Type -- a type
@@ -8,11 +8,11 @@ MkFoo : (bar : Nat) -> (baz : Bool) -> Foo a
8 baz : Bool -- A field baz
8 baz : Bool -- A field baz
9
9
10 The function is Total
10 The function is Total
11−bar : (rec : Foo a) -> Nat
11+Main.Foo.bar : (rec : Foo a) -> Nat
12 A field bar
12 A field bar
13
13
14 The function is Total
14 The function is Total
15−baz : (rec : Foo a) -> Bool
15+Main.Foo.baz : (rec : Foo a) -> Bool
16 A field baz
16 A field baz
17
17
18 The function is Total
18 The function is Total
test/idrisdoc009/expected+1−1
@@ -1,4 +1,4 @@
1−Data type Test : Type
1+Data type Test.Test : Type
2 Docs for datatype Test.
2 Docs for datatype Test.
3
3
4Constructors:
4Constructors:
test/interactive005/expected+5−5
@@ -1,14 +1,14 @@
13 : Nat
13 : Nat
2Hello, World
2Hello, World
3−main : IO ()
3+Main.main : IO ()
4 This is a docstring
4 This is a docstring
5
5
6 The function is Total
6 The function is Total
7Main.main is Total
7Main.main is Total
8Hello, World
8Hello, World
9−Prelude.Basics.id : a -> a
9+id : a -> a
10Prelude.Basics.id : {a : Type} -> (__pi_arg : a) -> a
10Prelude.Basics.id : {a : Type} -> (__pi_arg : a) -> a
11−Prelude.Basics.id : a -> a
11+id : a -> a
12
12
13 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
13 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -22,13 +22,13 @@ Prelude.Basics.id : a -> a
22 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
22 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
24
25−main : IO ()
25+Main.main : IO ()
26 This
26 This
27 is a
27 is a
28 docstring
28 docstring
29
29
30 The function is Total
30 The function is Total
31−main : IO ()
31+Main.main : IO ()
32 This is a docstring
32 This is a docstring
33
33
34 The function is Total
34 The function is Total