From 2f8a13bb69d951365b2b81a0455d819b4dfa8388 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 14 Sep 2022 17:58:06 +1000 Subject: updating tests relevant to previous changes --- org-test/ref/main.org | 490 +++++++++++++++++++++------------------- org-test/src/ConstructorArgs.hs | 57 +++++ 2 files changed, 318 insertions(+), 229 deletions(-) create mode 100644 org-test/src/ConstructorArgs.hs diff --git a/org-test/ref/main.org b/org-test/ref/main.org index e4b2b830..04335efa 100644 --- a/org-test/ref/main.org +++ b/org-test/ref/main.org @@ -1,18 +1,130 @@ * :PROPERTIES: - :CUSTOM_ID: main :Hackage: https://hackage.haskell.org/package/main :END: +** ConstructorArgs + :PROPERTIES: + :Hackage: https://hackage.haskell.org/package/main/docs/ConstructorArgs.html + :END: + +*** data Foo + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/t/Foo + :END: + +**** Rec { + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/Rec + :END: + +doc on a record + +***** x :: [[file:base.org::#Data.String/t/String][String]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/x + :END: + +doc on the [[file:base.org::#Data.String/t/String][String]] field of [[file:main.org::#ConstructorArgs/v/Rec][Rec]] + +***** y :: [[file:base.org::#Data.String/t/String][String]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/y + :END: + +doc on the [[file:base.org::#Data.String/t/String][String]] field of [[file:main.org::#ConstructorArgs/v/Rec][Rec]] + +**** Baz [[file:base.org::#Data.Int/t/Int][Int]] [[file:base.org::#Data.String/t/String][String]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/Baz + :END: + +old prefix doc style + +**** Boa ![[file:base.org::#Data.Int/t/Int][Int]] ![[file:base.org::#Data.String/t/String][String]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/Boa + :END: + +Arguments: + +- ![[file:base.org::#Data.Int/t/Int][Int]] :: doc on the [[file:base.org::#Data.String/t/String][String]] field of [[file:main.org::#ConstructorArgs/v/Boa][Boa]] +- ![[file:base.org::#Data.String/t/String][String]] :: + +doc on the [[file:main.org::#ConstructorArgs/v/Boa][Boa]] constrictor + +**** :| + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/:| + :END: + +old infix doc style + +**** :* + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/:* + :END: + +Arguments (in order): + +1. doc on the [[file:base.org::#Data.Int/t/Int][Int]] field of the [[file:main.org::#ConstructorArgs/v/:*][:*]] constructor +2. doc on the [[file:base.org::#Data.String/t/String][String]] field of the [[file:main.org::#ConstructorArgs/v/:*][:*]] constructor + +doc on the [[file:main.org::#ConstructorArgs/v/:*][:*]] constructor + +*** data Boo where + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/t/Boo + :END: + +**** Foo :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#Data.String/t/String][String]] -> [[file:main.org::#ConstructorArgs/t/Boo][Boo]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/Foo + :END: + +Arguments (in order): + +1. [[file:base.org::#Data.Int/t/Int][Int]] field of [[file:main.org::#ConstructorArgs/t/Foo][Foo]] +2. [[file:base.org::#Data.String/t/String][String]] field of [[file:main.org::#ConstructorArgs/t/Foo][Foo]] +3. Make a [[file:main.org::#ConstructorArgs/t/Boo][Boo]] + +Info about a [[file:main.org::#ConstructorArgs/t/Foo][Foo]] + +**** Foa :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:main.org::#ConstructorArgs/t/Boo][Boo]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/Foa + :END: + +no argument docs GADT + +*** pattern Bo :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#Data.String/t/String][String]] -> [[file:main.org::#ConstructorArgs/t/Boo][Boo]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/Bo + :END: + +Arguments: + +- [[file:base.org::#Data.Int/t/Int][Int]] :: an [[file:base.org::#Data.Int/t/Int][Int]] +- [[file:base.org::#Data.String/t/String][String]] :: a [[file:base.org::#Data.String/t/String][String]] +- [[file:main.org::#ConstructorArgs/t/Boo][Boo]] :: a [[file:main.org::#ConstructorArgs/t/Boo][Boo]] pattern + +Info about not-bundled [[file:main.org::#ConstructorArgs/v/Bo][Bo]] + +*** pattern Bo' :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#Data.String/t/String][String]] -> [[file:main.org::#ConstructorArgs/t/Boo][Boo]] + :PROPERTIES: + :CUSTOM_ID: ConstructorArgs/v/Bo' + :END: + +Not bundled and no argument docs + ** Test :PROPERTIES: - :CUSTOM_ID: main.Test :Hackage: https://hackage.haskell.org/package/main/docs/Test.html :END: -This module illustrates & tests most of the features of Haddock. Testing references from the description: [[#main.Test.T][T]], [[#main.Test.f][f]], [[#main.Test.g][g]], [[#main.Visible.visible][visible]]. +This module illustrates & tests most of the features of Haddock. Testing references from the description: [[file:main.org::#Test/t/T][T]], [[file:main.org::#Test/v/f][f]], [[file:main.org::#Test/v/g][g]], [[file:main.org::#Visible/v/visible][visible]]. *** Type declarations @@ -20,474 +132,410 @@ This module illustrates & tests most of the features of Haddock. Testing referen ***** data T a b :PROPERTIES: - :CUSTOM_ID: main.Test.T - :CUSTOM_ID: Test.T + :CUSTOM_ID: Test/t/T :END: This comment applies to the /following/ declaration and it continues until the next non-comment line -****** A [[#base.Data.Int.Int][Int]] ([[#base.Data.Maybe.Maybe][Maybe]] [[#base.Prelude.Float][Float]]) +****** A [[file:base.org::#Data.Int/t/Int][Int]] ([[file:base.org::#Data.Maybe/t/Maybe][Maybe]] [[file:base.org::#Prelude/t/Float][Float]]) :PROPERTIES: - :CUSTOM_ID: main.Test.A:dc - :CUSTOM_ID: Test.A:dc + :CUSTOM_ID: Test/v/A :END: -This comment describes the [[#main.Test.A:dc][A]] constructor +This comment describes the [[file:main.org::#Test/v/A][A]] constructor -****** B ([[#main.Test.T][T]] a b, [[#main.Test.T][T]] [[#base.Data.Int.Int][Int]] [[#base.Prelude.Float][Float]]) +****** B ([[file:main.org::#Test/t/T][T]] a b, [[file:main.org::#Test/t/T][T]] [[file:base.org::#Data.Int/t/Int][Int]] [[file:base.org::#Prelude/t/Float][Float]]) :PROPERTIES: - :CUSTOM_ID: main.Test.B:dc - :CUSTOM_ID: Test.B:dc + :CUSTOM_ID: Test/v/B :END: -This comment describes the [[#main.Test.B:dc][B]] constructor +This comment describes the [[file:main.org::#Test/v/B][B]] constructor ***** data T2 a b :PROPERTIES: - :CUSTOM_ID: main.Test.T2 - :CUSTOM_ID: Test.T2 + :CUSTOM_ID: Test/t/T2 :END: An abstract data declaration ***** data T3 a b :PROPERTIES: - :CUSTOM_ID: main.Test.T3 - :CUSTOM_ID: Test.T3 + :CUSTOM_ID: Test/t/T3 :END: A data declaration with no documentation annotations on the constructors ****** A1 a :PROPERTIES: - :CUSTOM_ID: main.Test.A1:dc - :CUSTOM_ID: Test.A1:dc + :CUSTOM_ID: Test/v/A1 :END: ****** B1 b :PROPERTIES: - :CUSTOM_ID: main.Test.B1:dc - :CUSTOM_ID: Test.B1:dc + :CUSTOM_ID: Test/v/B1 :END: ***** data T4 a b :PROPERTIES: - :CUSTOM_ID: main.Test.T4 - :CUSTOM_ID: Test.T4 + :CUSTOM_ID: Test/t/T4 :END: ****** A2 a :PROPERTIES: - :CUSTOM_ID: main.Test.A2:dc - :CUSTOM_ID: Test.A2:dc + :CUSTOM_ID: Test/v/A2 :END: ****** B2 b :PROPERTIES: - :CUSTOM_ID: main.Test.B2:dc - :CUSTOM_ID: Test.B2:dc + :CUSTOM_ID: Test/v/B2 :END: ***** data T5 a b :PROPERTIES: - :CUSTOM_ID: main.Test.T5 - :CUSTOM_ID: Test.T5 + :CUSTOM_ID: Test/t/T5 :END: ****** A3 a :PROPERTIES: - :CUSTOM_ID: main.Test.A3:dc - :CUSTOM_ID: Test.A3:dc + :CUSTOM_ID: Test/v/A3 :END: -documents [[#main.Test.A3:dc][A3]] +documents [[file:main.org::#Test/v/A3][A3]] ****** B3 b :PROPERTIES: - :CUSTOM_ID: main.Test.B3:dc - :CUSTOM_ID: Test.B3:dc + :CUSTOM_ID: Test/v/B3 :END: -documents [[#main.Test.B3:dc][B3]] +documents [[file:main.org::#Test/v/B3][B3]] ***** data T6 :PROPERTIES: - :CUSTOM_ID: main.Test.T6 - :CUSTOM_ID: Test.T6 + :CUSTOM_ID: Test/t/T6 :END: Testing alternative comment styles ****** A4 :PROPERTIES: - :CUSTOM_ID: main.Test.A4:dc - :CUSTOM_ID: Test.A4:dc + :CUSTOM_ID: Test/v/A4 :END: -This is the doc for [[#main.Test.A4:dc][A4]] +This is the doc for [[file:main.org::#Test/v/A4][A4]] ****** B4 :PROPERTIES: - :CUSTOM_ID: main.Test.B4:dc - :CUSTOM_ID: Test.B4:dc + :CUSTOM_ID: Test/v/B4 :END: -This is the doc for [[#main.Test.B4:dc][B4]] +This is the doc for [[file:main.org::#Test/v/B4][B4]] ****** C4 :PROPERTIES: - :CUSTOM_ID: main.Test.C4:dc - :CUSTOM_ID: Test.C4:dc + :CUSTOM_ID: Test/v/C4 :END: -This is the doc for [[#main.Test.C4:dc][C4]] +This is the doc for [[file:main.org::#Test/v/C4][C4]] ***** newtype N1 a :PROPERTIES: - :CUSTOM_ID: main.Test.N1 - :CUSTOM_ID: Test.N1 + :CUSTOM_ID: Test/t/N1 :END: A newtype ****** N1 a :PROPERTIES: - :CUSTOM_ID: main.Test.N1:dc - :CUSTOM_ID: Test.N1:dc + :CUSTOM_ID: Test/v/N1 :END: ***** newtype N2 a b :PROPERTIES: - :CUSTOM_ID: main.Test.N2 - :CUSTOM_ID: Test.N2 + :CUSTOM_ID: Test/t/N2 :END: A newtype with a fieldname ****** N2 { :PROPERTIES: - :CUSTOM_ID: main.Test.N2:dc - :CUSTOM_ID: Test.N2:dc + :CUSTOM_ID: Test/v/N2 :END: ******* n :: a b :PROPERTIES: - :CUSTOM_ID: main.Test.n - :CUSTOM_ID: Test.n + :CUSTOM_ID: Test/v/n :END: ***** newtype N3 a b :PROPERTIES: - :CUSTOM_ID: main.Test.N3 - :CUSTOM_ID: Test.N3 + :CUSTOM_ID: Test/t/N3 :END: A newtype with a fieldname, documentation on the field ****** N3 { :PROPERTIES: - :CUSTOM_ID: main.Test.N3:dc - :CUSTOM_ID: Test.N3:dc + :CUSTOM_ID: Test/v/N3 :END: ******* n3 :: a b :PROPERTIES: - :CUSTOM_ID: main.Test.n3 - :CUSTOM_ID: Test.n3 + :CUSTOM_ID: Test/v/n3 :END: -this is the [[#main.Test.n3][n3]] field +this is the [[file:main.org::#Test/v/n3][n3]] field ***** data N4 a b :PROPERTIES: - :CUSTOM_ID: main.Test.N4 - :CUSTOM_ID: Test.N4 + :CUSTOM_ID: Test/t/N4 :END: An abstract newtype - we show this one as data rather than newtype because the difference isn't visible to the programmer for an abstract type. ***** newtype N5 a b :PROPERTIES: - :CUSTOM_ID: main.Test.N5 - :CUSTOM_ID: Test.N5 + :CUSTOM_ID: Test/t/N5 :END: ****** N5 { :PROPERTIES: - :CUSTOM_ID: main.Test.N5:dc - :CUSTOM_ID: Test.N5:dc + :CUSTOM_ID: Test/v/N5 :END: ******* n5 :: a b :PROPERTIES: - :CUSTOM_ID: main.Test.n5 - :CUSTOM_ID: Test.n5 + :CUSTOM_ID: Test/v/n5 :END: no docs on the datatype or the constructor ***** newtype N6 a b :PROPERTIES: - :CUSTOM_ID: main.Test.N6 - :CUSTOM_ID: Test.N6 + :CUSTOM_ID: Test/t/N6 :END: ****** N6 { :PROPERTIES: - :CUSTOM_ID: main.Test.N6:dc - :CUSTOM_ID: Test.N6:dc + :CUSTOM_ID: Test/v/N6 :END: docs on the constructor only ******* n6 :: a b :PROPERTIES: - :CUSTOM_ID: main.Test.n6 - :CUSTOM_ID: Test.n6 + :CUSTOM_ID: Test/v/n6 :END: ***** newtype N7 a b :PROPERTIES: - :CUSTOM_ID: main.Test.N7 - :CUSTOM_ID: Test.N7 + :CUSTOM_ID: Test/t/N7 :END: docs on the newtype and the constructor ****** N7 { :PROPERTIES: - :CUSTOM_ID: main.Test.N7:dc - :CUSTOM_ID: Test.N7:dc + :CUSTOM_ID: Test/v/N7 :END: -The [[#main.Test.N7][N7]] constructor +The [[file:main.org::#Test/t/N7][N7]] constructor ******* n7 :: a b :PROPERTIES: - :CUSTOM_ID: main.Test.n7 - :CUSTOM_ID: Test.n7 + :CUSTOM_ID: Test/v/n7 :END: **** Records ***** data R :PROPERTIES: - :CUSTOM_ID: main.Test.R - :CUSTOM_ID: Test.R + :CUSTOM_ID: Test/t/R :END: -This is the documentation for the [[#main.Test.R][R]] record, which has four fields, [[#main.Test.p][p]], [[#main.Test.q][q]], [[#main.Test.r][r]], and [[#main.Test.s][s]]. +This is the documentation for the [[file:main.org::#Test/t/R][R]] record, which has four fields, [[file:main.org::#Test/v/p][p]], [[file:main.org::#Test/v/q][q]], [[file:main.org::#Test/v/r][r]], and [[file:main.org::#Test/v/s][s]]. ****** C1 { :PROPERTIES: - :CUSTOM_ID: main.Test.C1:dc - :CUSTOM_ID: Test.C1:dc + :CUSTOM_ID: Test/v/C1 :END: -This is the [[#main.Test.C1:dc][C1]] record constructor, with the following fields: +This is the [[file:main.org::#Test/v/C1][C1]] record constructor, with the following fields: -******* p :: [[#base.Data.Int.Int][Int]] +******* p :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.p - :CUSTOM_ID: Test.p + :CUSTOM_ID: Test/v/p :END: -This comment applies to the [[#main.Test.p][p]] field +This comment applies to the [[file:main.org::#Test/v/p][p]] field ******* q :: forall a. a -> a :PROPERTIES: - :CUSTOM_ID: main.Test.q - :CUSTOM_ID: Test.q + :CUSTOM_ID: Test/v/q :END: -This comment applies to the [[#main.Test.q][q]] field +This comment applies to the [[file:main.org::#Test/v/q][q]] field -******* r, s :: [[#base.Data.Int.Int][Int]] +******* r, s :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.r - :CUSTOM_ID: Test.r - :CUSTOM_ID: main.Test.s - :CUSTOM_ID: Test.s + :CUSTOM_ID: Test/v/r + :CUSTOM_ID: Test/v/s :END: -This comment applies to both [[#main.Test.r][r]] and [[#main.Test.s][s]] +This comment applies to both [[file:main.org::#Test/v/r][r]] and [[file:main.org::#Test/v/s][s]] ****** C2 { :PROPERTIES: - :CUSTOM_ID: main.Test.C2:dc - :CUSTOM_ID: Test.C2:dc + :CUSTOM_ID: Test/v/C2 :END: -This is the [[#main.Test.C2:dc][C2]] record constructor, also with some fields: +This is the [[file:main.org::#Test/v/C2][C2]] record constructor, also with some fields: -******* t :: [[#main.Test.T1][T1]] -> ([[#main.Test.T2][T2]] [[#base.Data.Int.Int][Int]] [[#base.Data.Int.Int][Int]]) -> ([[#main.Test.T3][T3]] [[#base.Data.Bool.Bool][Bool]] [[#base.Data.Bool.Bool][Bool]]) -> ([[#main.Test.T4][T4]] [[#base.Prelude.Float][Float]] [[#base.Prelude.Float][Float]]) -> [[#main.Test.T5][T5]] () () +******* t :: [[file:main.org::#Test/t/T1][T1]] -> ([[file:main.org::#Test/t/T2][T2]] [[file:base.org::#Data.Int/t/Int][Int]] [[file:base.org::#Data.Int/t/Int][Int]]) -> ([[file:main.org::#Test/t/T3][T3]] [[file:base.org::#Data.Bool/t/Bool][Bool]] [[file:base.org::#Data.Bool/t/Bool][Bool]]) -> ([[file:main.org::#Test/t/T4][T4]] [[file:base.org::#Prelude/t/Float][Float]] [[file:base.org::#Prelude/t/Float][Float]]) -> [[file:main.org::#Test/t/T5][T5]] () () :PROPERTIES: - :CUSTOM_ID: main.Test.t - :CUSTOM_ID: Test.t + :CUSTOM_ID: Test/v/t :END: -******* u, v :: [[#base.Data.Int.Int][Int]] +******* u, v :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.u - :CUSTOM_ID: Test.u - :CUSTOM_ID: main.Test.v - :CUSTOM_ID: Test.v + :CUSTOM_ID: Test/v/u + :CUSTOM_ID: Test/v/v :END: ***** data R1 :PROPERTIES: - :CUSTOM_ID: main.Test.R1 - :CUSTOM_ID: Test.R1 + :CUSTOM_ID: Test/t/R1 :END: Testing different record commenting styles ****** C3 { :PROPERTIES: - :CUSTOM_ID: main.Test.C3:dc - :CUSTOM_ID: Test.C3:dc + :CUSTOM_ID: Test/v/C3 :END: -This is the [[#main.Test.C3:dc][C3]] record constructor +This is the [[file:main.org::#Test/v/C3][C3]] record constructor -******* s1 :: [[#base.Data.Int.Int][Int]] +******* s1 :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.s1 - :CUSTOM_ID: Test.s1 + :CUSTOM_ID: Test/v/s1 :END: -The [[#main.Test.s1][s1]] record selector +The [[file:main.org::#Test/v/s1][s1]] record selector -******* s2 :: [[#base.Data.Int.Int][Int]] +******* s2 :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.s2 - :CUSTOM_ID: Test.s2 + :CUSTOM_ID: Test/v/s2 :END: -The [[#main.Test.s2][s2]] record selector +The [[file:main.org::#Test/v/s2][s2]] record selector -******* s3 :: [[#base.Data.Int.Int][Int]] +******* s3 :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.s3 - :CUSTOM_ID: Test.s3 + :CUSTOM_ID: Test/v/s3 :END: -The [[#main.Test.s3][s3]] record selector +The [[file:main.org::#Test/v/s3][s3]] record selector test that we can export record selectors on their own: -***** p :: [[#main.Test.R][R]] -> [[#base.Data.Int.Int][Int]] +***** p :: [[file:main.org::#Test/t/R][R]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.p - :CUSTOM_ID: Test.p + :CUSTOM_ID: Test/v/p :END: -This comment applies to the [[#main.Test.p][p]] field +This comment applies to the [[file:main.org::#Test/v/p][p]] field -***** q :: [[#main.Test.R][R]] -> forall a. a -> a +***** q :: [[file:main.org::#Test/t/R][R]] -> forall a. a -> a :PROPERTIES: - :CUSTOM_ID: main.Test.q - :CUSTOM_ID: Test.q + :CUSTOM_ID: Test/v/q :END: -This comment applies to the [[#main.Test.q][q]] field +This comment applies to the [[file:main.org::#Test/v/q][q]] field -***** u :: [[#main.Test.R][R]] -> [[#base.Data.Int.Int][Int]] +***** u :: [[file:main.org::#Test/t/R][R]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.u - :CUSTOM_ID: Test.u + :CUSTOM_ID: Test/v/u :END: *** Class declarations -**** class ([[#main.Test.D][D]] a) => C a +**** class ([[file:main.org::#Test/t/D][D]] a) => C a :PROPERTIES: - :CUSTOM_ID: main.Test.C - :CUSTOM_ID: Test.C + :CUSTOM_ID: Test/t/C :END: -This comment applies to the /previous/ declaration (the [[#main.Test.C][C]] class) +This comment applies to the /previous/ declaration (the [[file:main.org::#Test/t/C][C]] class) -***** a :: [[#base.System.IO.IO][IO]] a +***** a :: [[file:base.org::#System.IO/t/IO][IO]] a :PROPERTIES: - :CUSTOM_ID: main.Test.a - :CUSTOM_ID: Test.a + :CUSTOM_ID: Test/v/a :END: -this is a description of the [[#main.Test.a][a]] method +this is a description of the [[file:main.org::#Test/v/a][a]] method ***** b :: [a] :PROPERTIES: - :CUSTOM_ID: main.Test.b - :CUSTOM_ID: Test.b + :CUSTOM_ID: Test/v/b :END: -this is a description of the [[#main.Test.b][b]] method +this is a description of the [[file:main.org::#Test/v/b][b]] method **** class D a :PROPERTIES: - :CUSTOM_ID: main.Test.D - :CUSTOM_ID: Test.D + :CUSTOM_ID: Test/t/D :END: This is a class declaration with no separate docs for the methods -***** d :: [[#main.Test.T][T]] a b +***** d :: [[file:main.org::#Test/t/T][T]] a b :PROPERTIES: - :CUSTOM_ID: main.Test.d - :CUSTOM_ID: Test.d + :CUSTOM_ID: Test/v/d :END: ***** e :: (a, a) :PROPERTIES: - :CUSTOM_ID: main.Test.e - :CUSTOM_ID: Test.e + :CUSTOM_ID: Test/v/e :END: ***** Instances: -- [[#main.Test.D][D]] [[#base.Prelude.Float][Float]] -- [[#main.Test.D][D]] [[#base.Data.Int.Int][Int]] +- [[file:main.org::#Test/t/D][D]] [[file:base.org::#Prelude/t/Float][Float]] +- [[file:main.org::#Test/t/D][D]] [[file:base.org::#Data.Int/t/Int][Int]] **** class E a :PROPERTIES: - :CUSTOM_ID: main.Test.E - :CUSTOM_ID: Test.E + :CUSTOM_ID: Test/t/E :END: This is a class declaration with no methods (or no methods exported) **** class F a :PROPERTIES: - :CUSTOM_ID: main.Test.F - :CUSTOM_ID: Test.F + :CUSTOM_ID: Test/t/F :END: ***** ff :: a :PROPERTIES: - :CUSTOM_ID: main.Test.ff - :CUSTOM_ID: Test.ff + :CUSTOM_ID: Test/v/ff :END: Test that we can export a class method on its own: -**** a :: [[#main.Test.C][C]] a => [[#base.System.IO.IO][IO]] a +**** a :: [[file:main.org::#Test/t/C][C]] a => [[file:base.org::#System.IO/t/IO][IO]] a :PROPERTIES: - :CUSTOM_ID: main.Test.a - :CUSTOM_ID: Test.a + :CUSTOM_ID: Test/v/a :END: -this is a description of the [[#main.Test.a][a]] method +this is a description of the [[file:main.org::#Test/v/a][a]] method *** Function types -**** f :: [[#main.Test.C][C]] a => a -> [[#base.Data.Int.Int][Int]] +**** f :: [[file:main.org::#Test/t/C][C]] a => a -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.f - :CUSTOM_ID: Test.f + :CUSTOM_ID: Test/v/f :END: -In a comment string we can refer to identifiers in scope with single quotes like this: [[#main.Test.T][T]], and we can refer to modules by using double quotes: [[Foo]]. We can add emphasis /like this/. +In a comment string we can refer to identifiers in scope with single quotes like this: [[file:main.org::#Test/t/T][T]], and we can refer to modules by using double quotes: [[Foo]]. We can add emphasis /like this/. - This is a bulleted list - This is the next item (different kind of bullet) @@ -511,10 +559,9 @@ this is another block of code We can also include URLs in documentation: [[http://www.haskell.org/]]. -**** g :: [[#base.Data.Int.Int][Int]] -> [[#base.System.IO.IO][IO]] [[#main.Test.CInt][CInt]] +**** g :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#System.IO/t/IO][IO]] [[file:main.org::#Test/t/CInt][CInt]] :PROPERTIES: - :CUSTOM_ID: main.Test.g - :CUSTOM_ID: Test.g + :CUSTOM_ID: Test/v/g :END: we can export foreign declarations too @@ -615,10 +662,9 @@ is at the beginning of the line). *** A hidden module -**** hidden :: [[#base.Data.Int.Int][Int]] -> [[#base.Data.Int.Int][Int]] +**** hidden :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.hidden - :CUSTOM_ID: Test.hidden + :CUSTOM_ID: Test/v/hidden :END: *** A visible module @@ -631,83 +677,74 @@ nested-style doc comments **** data Ex a :PROPERTIES: - :CUSTOM_ID: main.Test.Ex - :CUSTOM_ID: Test.Ex + :CUSTOM_ID: Test/t/Ex :END: A data-type using existential/universal types -***** forall b. [[#main.Test.C][C]] b => Ex1 b +***** forall b. [[file:main.org::#Test/t/C][C]] b => Ex1 b :PROPERTIES: - :CUSTOM_ID: main.Test.Ex1:dc - :CUSTOM_ID: Test.Ex1:dc + :CUSTOM_ID: Test/v/Ex1 :END: ***** forall b. Ex2 b :PROPERTIES: - :CUSTOM_ID: main.Test.Ex2:dc - :CUSTOM_ID: Test.Ex2:dc + :CUSTOM_ID: Test/v/Ex2 :END: -***** forall b. [[#main.Test.C][C]] a => Ex3 b +***** forall b. [[file:main.org::#Test/t/C][C]] a => Ex3 b :PROPERTIES: - :CUSTOM_ID: main.Test.Ex3:dc - :CUSTOM_ID: Test.Ex3:dc + :CUSTOM_ID: Test/v/Ex3 :END: ***** Ex4 (forall a. a -> a) :PROPERTIES: - :CUSTOM_ID: main.Test.Ex4:dc - :CUSTOM_ID: Test.Ex4:dc + :CUSTOM_ID: Test/v/Ex4 :END: *** Type signatures with argument docs -**** k :: [[#main.Test.T][T]] () () -> [[#main.Test.T2][T2]] [[#base.Data.Int.Int][Int]] [[#base.Data.Int.Int][Int]] -> ([[#main.Test.T3][T3]] [[#base.Data.Bool.Bool][Bool]] [[#base.Data.Bool.Bool][Bool]] -> [[#main.Test.T4][T4]] [[#base.Prelude.Float][Float]] [[#base.Prelude.Float][Float]]) -> [[#main.Test.T5][T5]] () () -> [[#base.System.IO.IO][IO]] () +**** k :: [[file:main.org::#Test/t/T][T]] () () -> [[file:main.org::#Test/t/T2][T2]] [[file:base.org::#Data.Int/t/Int][Int]] [[file:base.org::#Data.Int/t/Int][Int]] -> ([[file:main.org::#Test/t/T3][T3]] [[file:base.org::#Data.Bool/t/Bool][Bool]] [[file:base.org::#Data.Bool/t/Bool][Bool]] -> [[file:main.org::#Test/t/T4][T4]] [[file:base.org::#Prelude/t/Float][Float]] [[file:base.org::#Prelude/t/Float][Float]]) -> [[file:main.org::#Test/t/T5][T5]] () () -> [[file:base.org::#System.IO/t/IO][IO]] () :PROPERTIES: - :CUSTOM_ID: main.Test.k - :CUSTOM_ID: Test.k + :CUSTOM_ID: Test/v/k :END: Arguments: -- [[#main.Test.T][T]] () () :: This argument has type [[#main.Test.T][T]] -- ([[#main.Test.T2][T2]] [[#base.Data.Int.Int][Int]] [[#base.Data.Int.Int][Int]]) :: This argument has type 'T2 Int Int' -- ([[#main.Test.T3][T3]] [[#base.Data.Bool.Bool][Bool]] [[#base.Data.Bool.Bool][Bool]] -> [[#main.Test.T4][T4]] [[#base.Prelude.Float][Float]] [[#base.Prelude.Float][Float]]) :: This argument has type ~T3 Bool Bool -> T4 Float Float~ -- [[#main.Test.T5][T5]] () () :: This argument has a very long description that should hopefully cause some wrapping to happen when it is finally rendered by Haddock in the generated HTML page. -- [[#base.System.IO.IO][IO]] () :: This is the result type +- [[file:main.org::#Test/t/T][T]] () () :: This argument has type [[file:main.org::#Test/t/T][T]] +- ([[file:main.org::#Test/t/T2][T2]] [[file:base.org::#Data.Int/t/Int][Int]] [[file:base.org::#Data.Int/t/Int][Int]]) :: This argument has type 'T2 Int Int' +- ([[file:main.org::#Test/t/T3][T3]] [[file:base.org::#Data.Bool/t/Bool][Bool]] [[file:base.org::#Data.Bool/t/Bool][Bool]] -> [[file:main.org::#Test/t/T4][T4]] [[file:base.org::#Prelude/t/Float][Float]] [[file:base.org::#Prelude/t/Float][Float]]) :: This argument has type ~T3 Bool Bool -> T4 Float Float~ +- [[file:main.org::#Test/t/T5][T5]] () () :: This argument has a very long description that should hopefully cause some wrapping to happen when it is finally rendered by Haddock in the generated HTML page. +- [[file:base.org::#System.IO/t/IO][IO]] () :: This is the result type This is a function with documentation for each argument -**** l :: ([[#base.Data.Int.Int][Int]], [[#base.Data.Int.Int][Int]], [[#base.Prelude.Float][Float]]) -> [[#base.Data.Int.Int][Int]] +**** l :: ([[file:base.org::#Data.Int/t/Int][Int]], [[file:base.org::#Data.Int/t/Int][Int]], [[file:base.org::#Prelude/t/Float][Float]]) -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.l - :CUSTOM_ID: Test.l + :CUSTOM_ID: Test/v/l :END: Arguments: -- ([[#base.Data.Int.Int][Int]], [[#base.Data.Int.Int][Int]], [[#base.Prelude.Float][Float]]) :: takes a triple -- [[#base.Data.Int.Int][Int]] :: returns an [[#base.Data.Int.Int][Int]] +- ([[file:base.org::#Data.Int/t/Int][Int]], [[file:base.org::#Data.Int/t/Int][Int]], [[file:base.org::#Prelude/t/Float][Float]]) :: takes a triple +- [[file:base.org::#Data.Int/t/Int][Int]] :: returns an [[file:base.org::#Data.Int/t/Int][Int]] -**** m :: [[#main.Test.R][R]] -> [[#main.Test.N1][N1]] () -> [[#base.System.IO.IO][IO]] [[#base.Data.Int.Int][Int]] +**** m :: [[file:main.org::#Test/t/R][R]] -> [[file:main.org::#Test/t/N1][N1]] () -> [[file:base.org::#System.IO/t/IO][IO]] [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.m - :CUSTOM_ID: Test.m + :CUSTOM_ID: Test/v/m :END: Arguments: -- [[#main.Test.R][R]] :: -- [[#main.Test.N1][N1]] () :: one of the arguments -- [[#base.System.IO.IO][IO]] [[#base.Data.Int.Int][Int]] :: and the return value +- [[file:main.org::#Test/t/R][R]] :: +- [[file:main.org::#Test/t/N1][N1]] () :: one of the arguments +- [[file:base.org::#System.IO/t/IO][IO]] [[file:base.org::#Data.Int/t/Int][Int]] :: and the return value This function has some arg docs -**** o :: [[#base.Prelude.Float][Float]] -> [[#base.System.IO.IO][IO]] [[#base.Prelude.Float][Float]] +**** o :: [[file:base.org::#Prelude/t/Float][Float]] -> [[file:base.org::#System.IO/t/IO][IO]] [[file:base.org::#Prelude/t/Float][Float]] :PROPERTIES: - :CUSTOM_ID: main.Test.o - :CUSTOM_ID: Test.o + :CUSTOM_ID: Test/v/o :END: Arguments (in order): @@ -727,38 +764,33 @@ a literal line $ a non /literal/ line $ -***** f' :: [[#base.Data.Int.Int][Int]] +***** f' :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.f' - :CUSTOM_ID: Test.f' + :CUSTOM_ID: Test/v/f' :END: -a function with a prime can be referred to as [[#main.Test.f'][f']] but f' doesn't get link'd 'f'' +a function with a prime can be referred to as [[file:main.org::#Test/v/f'][f']] but f' doesn't get link'd 'f'' -***** withType :: [[#base.Data.Int.Int][Int]] +***** withType :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Test.withType - :CUSTOM_ID: Test.withType + :CUSTOM_ID: Test/v/withType :END: Comment on a definition with type signature ***** withoutType :: a :PROPERTIES: - :CUSTOM_ID: main.Test.withoutType - :CUSTOM_ID: Test.withoutType + :CUSTOM_ID: Test/v/withoutType :END: Comment on a definition without type signature ** Visible :PROPERTIES: - :CUSTOM_ID: main.Visible :Hackage: https://hackage.haskell.org/package/main/docs/Visible.html :END: -*** visible :: [[#base.Data.Int.Int][Int]] -> [[#base.Data.Int.Int][Int]] +*** visible :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: - :CUSTOM_ID: main.Visible.visible - :CUSTOM_ID: Visible.visible + :CUSTOM_ID: Visible/v/visible :END: diff --git a/org-test/src/ConstructorArgs.hs b/org-test/src/ConstructorArgs.hs new file mode 100644 index 00000000..40697d13 --- /dev/null +++ b/org-test/src/ConstructorArgs.hs @@ -0,0 +1,57 @@ +{-# LANGUAGE Haskell2010 #-} +{-# LANGUAGE GADTs, PatternSynonyms #-} + +module ConstructorArgs (Foo(..), Boo(Foo, Foa, Fo, Fo'), pattern Bo, pattern Bo') where + +data Foo + = Rec -- ^ doc on a record + { x :: String -- ^ doc on the `String` field of `Rec` + , y :: String -- ^ doc on the `String` field of `Rec` + } + | Baz Int String -- ^ old prefix doc style + | Boa -- ^ doc on the `Boa` constrictor + !Int -- ^ doc on the `Int` field of `Boa` + !String -- ^ doc on the `String` field of `Boa` + | Int :| String -- ^ old infix doc style + | Int -- ^ doc on the `Int` field of the `:*` constructor + :* -- ^ doc on the `:*` constructor + String -- ^ doc on the `String` field of the `:*` constructor + +infixr 1 `Foo` +infixr 2 `Boa` +infixr 3 :* + +data Boo where + -- | Info about a 'Foo' + Foo :: Int -- ^ `Int` field of `Foo` + -> String -- ^ `String` field of `Foo` + -> Boo -- ^ Make a `Boo` + + -- | no argument docs GADT + Foa :: Int -> Boo + +infixr 4 `Boo` + +-- | Info about bundled 'Fo' +pattern Fo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' +pattern Fo x y = Foo x y + +-- | Bundled and no argument docs +pattern Fo' :: Boo +pattern Fo' = Foo 1 "hi" + +infixr 5 `Fo` + +-- | Info about not-bundled 'Bo' +pattern Bo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' pattern +pattern Bo x y = Foo x y + +-- | Not bundled and no argument docs +pattern Bo' :: Int -> String -> Boo +pattern Bo' x y = Foo x y + +infixr 6 `Bo` -- cgit v1.2.3