* :PROPERTIES: :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: :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: [[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 **** Data types ***** data T a b :PROPERTIES: :CUSTOM_ID: Test/t/T :END: This comment applies to the /following/ declaration and it continues until the next non-comment line ****** 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: Test/v/A :END: This comment describes the [[file:main.org::#Test/v/A][A]] constructor ****** 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: Test/v/B :END: This comment describes the [[file:main.org::#Test/v/B][B]] constructor ***** data T2 a b :PROPERTIES: :CUSTOM_ID: Test/t/T2 :END: An abstract data declaration ***** data T3 a b :PROPERTIES: :CUSTOM_ID: Test/t/T3 :END: A data declaration with no documentation annotations on the constructors ****** A1 a :PROPERTIES: :CUSTOM_ID: Test/v/A1 :END: ****** B1 b :PROPERTIES: :CUSTOM_ID: Test/v/B1 :END: ***** data T4 a b :PROPERTIES: :CUSTOM_ID: Test/t/T4 :END: ****** A2 a :PROPERTIES: :CUSTOM_ID: Test/v/A2 :END: ****** B2 b :PROPERTIES: :CUSTOM_ID: Test/v/B2 :END: ***** data T5 a b :PROPERTIES: :CUSTOM_ID: Test/t/T5 :END: ****** A3 a :PROPERTIES: :CUSTOM_ID: Test/v/A3 :END: documents [[file:main.org::#Test/v/A3][A3]] ****** B3 b :PROPERTIES: :CUSTOM_ID: Test/v/B3 :END: documents [[file:main.org::#Test/v/B3][B3]] ***** data T6 :PROPERTIES: :CUSTOM_ID: Test/t/T6 :END: Testing alternative comment styles ****** A4 :PROPERTIES: :CUSTOM_ID: Test/v/A4 :END: This is the doc for [[file:main.org::#Test/v/A4][A4]] ****** B4 :PROPERTIES: :CUSTOM_ID: Test/v/B4 :END: This is the doc for [[file:main.org::#Test/v/B4][B4]] ****** C4 :PROPERTIES: :CUSTOM_ID: Test/v/C4 :END: This is the doc for [[file:main.org::#Test/v/C4][C4]] ***** newtype N1 a :PROPERTIES: :CUSTOM_ID: Test/t/N1 :END: A newtype ****** N1 a :PROPERTIES: :CUSTOM_ID: Test/v/N1 :END: ***** newtype N2 a b :PROPERTIES: :CUSTOM_ID: Test/t/N2 :END: A newtype with a fieldname ****** N2 { :PROPERTIES: :CUSTOM_ID: Test/v/N2 :END: ******* n :: a b :PROPERTIES: :CUSTOM_ID: Test/v/n :END: ***** newtype N3 a b :PROPERTIES: :CUSTOM_ID: Test/t/N3 :END: A newtype with a fieldname, documentation on the field ****** N3 { :PROPERTIES: :CUSTOM_ID: Test/v/N3 :END: ******* n3 :: a b :PROPERTIES: :CUSTOM_ID: Test/v/n3 :END: this is the [[file:main.org::#Test/v/n3][n3]] field ***** data N4 a b :PROPERTIES: :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: Test/t/N5 :END: ****** N5 { :PROPERTIES: :CUSTOM_ID: Test/v/N5 :END: ******* n5 :: a b :PROPERTIES: :CUSTOM_ID: Test/v/n5 :END: no docs on the datatype or the constructor ***** newtype N6 a b :PROPERTIES: :CUSTOM_ID: Test/t/N6 :END: ****** N6 { :PROPERTIES: :CUSTOM_ID: Test/v/N6 :END: docs on the constructor only ******* n6 :: a b :PROPERTIES: :CUSTOM_ID: Test/v/n6 :END: ***** newtype N7 a b :PROPERTIES: :CUSTOM_ID: Test/t/N7 :END: docs on the newtype and the constructor ****** N7 { :PROPERTIES: :CUSTOM_ID: Test/v/N7 :END: The [[file:main.org::#Test/t/N7][N7]] constructor ******* n7 :: a b :PROPERTIES: :CUSTOM_ID: Test/v/n7 :END: **** Records ***** data R :PROPERTIES: :CUSTOM_ID: Test/t/R :END: 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: Test/v/C1 :END: This is the [[file:main.org::#Test/v/C1][C1]] record constructor, with the following fields: ******* p :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/p :END: This comment applies to the [[file:main.org::#Test/v/p][p]] field ******* q :: forall a. a -> a :PROPERTIES: :CUSTOM_ID: Test/v/q :END: This comment applies to the [[file:main.org::#Test/v/q][q]] field ******* r, s :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/r :CUSTOM_ID: Test/v/s :END: This comment applies to both [[file:main.org::#Test/v/r][r]] and [[file:main.org::#Test/v/s][s]] ****** C2 { :PROPERTIES: :CUSTOM_ID: Test/v/C2 :END: This is the [[file:main.org::#Test/v/C2][C2]] record constructor, also with some fields: ******* 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: Test/v/t :END: ******* u, v :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/u :CUSTOM_ID: Test/v/v :END: ***** data R1 :PROPERTIES: :CUSTOM_ID: Test/t/R1 :END: Testing different record commenting styles ****** C3 { :PROPERTIES: :CUSTOM_ID: Test/v/C3 :END: This is the [[file:main.org::#Test/v/C3][C3]] record constructor ******* s1 :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/s1 :END: The [[file:main.org::#Test/v/s1][s1]] record selector ******* s2 :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/s2 :END: The [[file:main.org::#Test/v/s2][s2]] record selector ******* s3 :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/s3 :END: The [[file:main.org::#Test/v/s3][s3]] record selector test that we can export record selectors on their own: ***** p :: [[file:main.org::#Test/t/R][R]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/p :END: This comment applies to the [[file:main.org::#Test/v/p][p]] field ***** q :: [[file:main.org::#Test/t/R][R]] -> forall a. a -> a :PROPERTIES: :CUSTOM_ID: Test/v/q :END: This comment applies to the [[file:main.org::#Test/v/q][q]] field ***** u :: [[file:main.org::#Test/t/R][R]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/u :END: *** Class declarations **** class ([[file:main.org::#Test/t/D][D]] a) => C a :PROPERTIES: :CUSTOM_ID: Test/t/C :END: This comment applies to the /previous/ declaration (the [[file:main.org::#Test/t/C][C]] class) ***** a :: [[file:base.org::#System.IO/t/IO][IO]] a :PROPERTIES: :CUSTOM_ID: Test/v/a :END: this is a description of the [[file:main.org::#Test/v/a][a]] method ***** b :: [a] :PROPERTIES: :CUSTOM_ID: Test/v/b :END: this is a description of the [[file:main.org::#Test/v/b][b]] method **** class D a :PROPERTIES: :CUSTOM_ID: Test/t/D :END: This is a class declaration with no separate docs for the methods ***** d :: [[file:main.org::#Test/t/T][T]] a b :PROPERTIES: :CUSTOM_ID: Test/v/d :END: ***** e :: (a, a) :PROPERTIES: :CUSTOM_ID: Test/v/e :END: ***** Instances: - [[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: Test/t/E :END: This is a class declaration with no methods (or no methods exported) **** class F a :PROPERTIES: :CUSTOM_ID: Test/t/F :END: ***** ff :: a :PROPERTIES: :CUSTOM_ID: Test/v/ff :END: Test that we can export a class method on its own: **** a :: [[file:main.org::#Test/t/C][C]] a => [[file:base.org::#System.IO/t/IO][IO]] a :PROPERTIES: :CUSTOM_ID: Test/v/a :END: this is a description of the [[file:main.org::#Test/v/a][a]] method *** Function types **** f :: [[file:main.org::#Test/t/C][C]] a => a -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/f :END: 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) 1. This is an ordered list 2. This is the next item (different kind of bullet) - cat :: a small, furry, domesticated mammal - pineapple :: a fruit grown in the tropics #+begin_src haskell This is a block of code, which can include other markup: R formatting is significant #+end_src #+begin_src haskell this is another block of code #+end_src We can also include URLs in documentation: [[http://www.haskell.org/]]. **** 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: Test/v/g :END: we can export foreign declarations too *** Auxiliary stuff This is some documentation that is attached to a name ($aux1) rather than a source declaration. The documentation may be referred to in the export list using its name. #+begin_src haskell code block in named doc #+end_src This is some documentation that is attached to a name ($aux2) #+begin_src haskell code block on its own in named doc #+end_src #+begin_src haskell code block on its own in named doc (after newline) #+end_src a nested, named doc comment with a paragraph, #+begin_src haskell and a code block #+end_src #+begin_src haskell test test1 #+end_src #+begin_src haskell test2 test3 #+end_src #+begin_src haskell test1 test2 #+end_src #+begin_src haskell test3 test4 #+end_src #+begin_src haskell test1 test2 #+end_src #+begin_src haskell test3 test4 #+end_src #+begin_src haskell test3 test4 #+end_src #+begin_src haskell test1 test2 #+end_src aux11: #+begin_src haskell test3 test4 #+end_src #+begin_src haskell test1 test2 #+end_src #+begin_src haskell foo #+end_src #+begin_src haskell bar #+end_src This is some inline documentation in the export list #+begin_src haskell a code block using bird-tracks each line must begin with > (which isn't significant unless it is at the beginning of the line). #+end_src *** A hidden module **** hidden :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/hidden :END: *** A visible module **** module [[Visible]] nested-style doc comments *** Existential / Universal types **** data Ex a :PROPERTIES: :CUSTOM_ID: Test/t/Ex :END: A data-type using existential/universal types ***** forall b. [[file:main.org::#Test/t/C][C]] b => Ex1 b :PROPERTIES: :CUSTOM_ID: Test/v/Ex1 :END: ***** forall b. Ex2 b :PROPERTIES: :CUSTOM_ID: Test/v/Ex2 :END: ***** forall b. [[file:main.org::#Test/t/C][C]] a => Ex3 b :PROPERTIES: :CUSTOM_ID: Test/v/Ex3 :END: ***** Ex4 (forall a. a -> a) :PROPERTIES: :CUSTOM_ID: Test/v/Ex4 :END: *** Type signatures with argument docs **** 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: Test/v/k :END: Arguments: - [[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 :: ([[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: Test/v/l :END: Arguments: - ([[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 :: [[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: Test/v/m :END: Arguments: - [[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 :: [[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: Test/v/o :END: Arguments (in order): 1. The input float 2. The output float A foreign import with argument docs *** A section **** A subsection #+begin_src haskell a literal line #+end_src $ a non /literal/ line $ ***** f' :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/f' :END: 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 :: [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Test/v/withType :END: Comment on a definition with type signature ***** withoutType :: a :PROPERTIES: :CUSTOM_ID: Test/v/withoutType :END: Comment on a definition without type signature ** Visible :PROPERTIES: :Hackage: https://hackage.haskell.org/package/main/docs/Visible.html :END: *** visible :: [[file:base.org::#Data.Int/t/Int][Int]] -> [[file:base.org::#Data.Int/t/Int][Int]] :PROPERTIES: :CUSTOM_ID: Visible/v/visible :END: