From 33ab68b67ce865cd6447b41eda6d64ed0f65e8d9 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sat, 12 Apr 2008 18:57:23 +0000 Subject: Simplify test suite and add tests I move all tests into one single directory to simplify things, and add a test for the last bug that was fixed. --- tests/copy.hs | 0 tests/extensions/TypeOperators.hs | 22 - tests/extensions/TypeOperators.html.ref | 380 ---- tests/output/A.html | 116 ++ tests/output/A.html.ref | 116 ++ tests/output/B.html | 86 + tests/output/B.html.ref | 86 + tests/output/Bug1.html | 150 ++ tests/output/Bug1.html.ref | 150 ++ tests/output/Bug2.html | 90 + tests/output/Bug2.html.ref | 90 + tests/output/Bug3.html | 114 ++ tests/output/Bug3.html.ref | 114 ++ tests/output/Bug4.html | 113 ++ tests/output/Bug4.html.ref | 113 ++ tests/output/Bug6.html | 482 +++++ tests/output/Bug6.html.ref | 482 +++++ tests/output/Bug7.html | 242 +++ tests/output/Bug7.html.ref | 242 +++ tests/output/Bug8.html | 128 ++ tests/output/Bug8.html.ref | 128 ++ tests/output/Bugs.html | 116 ++ tests/output/Hash.html | 412 ++++ tests/output/Hash.html.ref | 412 ++++ tests/output/Hidden.html.ref | 88 + tests/output/NoLayout.html | 113 ++ tests/output/NoLayout.html.ref | 113 ++ tests/output/Test.html | 3105 +++++++++++++++++++++++++++++++ tests/output/Test.html.ref | 3105 +++++++++++++++++++++++++++++++ tests/output/TypeOperators.html | 380 ++++ tests/output/TypeOperators.html.ref | 380 ++++ tests/output/Visible.html | 88 + tests/output/Visible.html.ref | 88 + tests/output/doc-index.html | 1104 +++++++++++ tests/output/index.html | 208 +++ tests/pre-2.0-tests/A.hs | 2 - tests/pre-2.0-tests/A.html.ref | 116 -- tests/pre-2.0-tests/B.hs | 2 - tests/pre-2.0-tests/B.html.ref | 86 - tests/pre-2.0-tests/Bug1.hs | 6 - tests/pre-2.0-tests/Bug1.html.ref | 150 -- tests/pre-2.0-tests/Bug2.hs | 4 - tests/pre-2.0-tests/Bug2.html.ref | 90 - tests/pre-2.0-tests/Bug3.hs | 6 - tests/pre-2.0-tests/Bug3.html.ref | 114 -- tests/pre-2.0-tests/Bug4.hs | 5 - tests/pre-2.0-tests/Bug4.html.ref | 113 -- tests/pre-2.0-tests/Bug6.hs | 23 - tests/pre-2.0-tests/Bug6.html.ref | 482 ----- tests/pre-2.0-tests/Bug7.hs | 12 - tests/pre-2.0-tests/Bug7.html.ref | 242 --- tests/pre-2.0-tests/Bug8.hs | 17 - tests/pre-2.0-tests/Bug8.html.ref | 128 -- tests/pre-2.0-tests/Hash.hs | 51 - tests/pre-2.0-tests/Hash.html.ref | 412 ---- tests/pre-2.0-tests/Hidden.hs | 4 - tests/pre-2.0-tests/Hidden.html.ref | 88 - tests/pre-2.0-tests/NoLayout.hs | 12 - tests/pre-2.0-tests/NoLayout.html.ref | 113 -- tests/pre-2.0-tests/Test.hs | 410 ---- tests/pre-2.0-tests/Test.html.ref | 3105 ------------------------------- tests/pre-2.0-tests/Visible.hs | 3 - tests/pre-2.0-tests/Visible.html.ref | 88 - tests/runtests.hs | 36 +- tests/tests/A.hs | 2 + tests/tests/A.html.ref | 116 ++ tests/tests/B.hs | 2 + tests/tests/B.html.ref | 86 + tests/tests/Bug1.hs | 6 + tests/tests/Bug1.html.ref | 150 ++ tests/tests/Bug2.hs | 4 + tests/tests/Bug2.html.ref | 90 + tests/tests/Bug3.hs | 6 + tests/tests/Bug3.html.ref | 114 ++ tests/tests/Bug4.hs | 5 + tests/tests/Bug4.html.ref | 113 ++ tests/tests/Bug6.hs | 23 + tests/tests/Bug6.html.ref | 482 +++++ tests/tests/Bug7.hs | 12 + tests/tests/Bug7.html.ref | 242 +++ tests/tests/Bug8.hs | 17 + tests/tests/Bug8.html.ref | 128 ++ tests/tests/Bugs.hs | 3 + tests/tests/Bugs.html.ref | 116 ++ tests/tests/Hash.hs | 51 + tests/tests/Hash.html.ref | 412 ++++ tests/tests/Hidden.hs | 4 + tests/tests/NoLayout.hs | 12 + tests/tests/NoLayout.html.ref | 113 ++ tests/tests/Test.hs | 410 ++++ tests/tests/Test.html.ref | 3105 +++++++++++++++++++++++++++++++ tests/tests/TypeOperators.hs | 22 + tests/tests/TypeOperators.html.ref | 380 ++++ tests/tests/Visible.hs | 3 + tests/tests/Visible.html.ref | 88 + 95 files changed, 19082 insertions(+), 6311 deletions(-) create mode 100644 tests/copy.hs delete mode 100644 tests/extensions/TypeOperators.hs delete mode 100644 tests/extensions/TypeOperators.html.ref create mode 100644 tests/output/A.html create mode 100644 tests/output/A.html.ref create mode 100644 tests/output/B.html create mode 100644 tests/output/B.html.ref create mode 100644 tests/output/Bug1.html create mode 100644 tests/output/Bug1.html.ref create mode 100644 tests/output/Bug2.html create mode 100644 tests/output/Bug2.html.ref create mode 100644 tests/output/Bug3.html create mode 100644 tests/output/Bug3.html.ref create mode 100644 tests/output/Bug4.html create mode 100644 tests/output/Bug4.html.ref create mode 100644 tests/output/Bug6.html create mode 100644 tests/output/Bug6.html.ref create mode 100644 tests/output/Bug7.html create mode 100644 tests/output/Bug7.html.ref create mode 100644 tests/output/Bug8.html create mode 100644 tests/output/Bug8.html.ref create mode 100644 tests/output/Bugs.html create mode 100644 tests/output/Hash.html create mode 100644 tests/output/Hash.html.ref create mode 100644 tests/output/Hidden.html.ref create mode 100644 tests/output/NoLayout.html create mode 100644 tests/output/NoLayout.html.ref create mode 100644 tests/output/Test.html create mode 100644 tests/output/Test.html.ref create mode 100644 tests/output/TypeOperators.html create mode 100644 tests/output/TypeOperators.html.ref create mode 100644 tests/output/Visible.html create mode 100644 tests/output/Visible.html.ref create mode 100644 tests/output/doc-index.html create mode 100644 tests/output/index.html delete mode 100644 tests/pre-2.0-tests/A.hs delete mode 100644 tests/pre-2.0-tests/A.html.ref delete mode 100644 tests/pre-2.0-tests/B.hs delete mode 100644 tests/pre-2.0-tests/B.html.ref delete mode 100644 tests/pre-2.0-tests/Bug1.hs delete mode 100644 tests/pre-2.0-tests/Bug1.html.ref delete mode 100644 tests/pre-2.0-tests/Bug2.hs delete mode 100644 tests/pre-2.0-tests/Bug2.html.ref delete mode 100644 tests/pre-2.0-tests/Bug3.hs delete mode 100644 tests/pre-2.0-tests/Bug3.html.ref delete mode 100644 tests/pre-2.0-tests/Bug4.hs delete mode 100644 tests/pre-2.0-tests/Bug4.html.ref delete mode 100644 tests/pre-2.0-tests/Bug6.hs delete mode 100644 tests/pre-2.0-tests/Bug6.html.ref delete mode 100644 tests/pre-2.0-tests/Bug7.hs delete mode 100644 tests/pre-2.0-tests/Bug7.html.ref delete mode 100644 tests/pre-2.0-tests/Bug8.hs delete mode 100644 tests/pre-2.0-tests/Bug8.html.ref delete mode 100644 tests/pre-2.0-tests/Hash.hs delete mode 100644 tests/pre-2.0-tests/Hash.html.ref delete mode 100644 tests/pre-2.0-tests/Hidden.hs delete mode 100644 tests/pre-2.0-tests/Hidden.html.ref delete mode 100644 tests/pre-2.0-tests/NoLayout.hs delete mode 100644 tests/pre-2.0-tests/NoLayout.html.ref delete mode 100644 tests/pre-2.0-tests/Test.hs delete mode 100644 tests/pre-2.0-tests/Test.html.ref delete mode 100644 tests/pre-2.0-tests/Visible.hs delete mode 100644 tests/pre-2.0-tests/Visible.html.ref create mode 100644 tests/tests/A.hs create mode 100644 tests/tests/A.html.ref create mode 100644 tests/tests/B.hs create mode 100644 tests/tests/B.html.ref create mode 100644 tests/tests/Bug1.hs create mode 100644 tests/tests/Bug1.html.ref create mode 100644 tests/tests/Bug2.hs create mode 100644 tests/tests/Bug2.html.ref create mode 100644 tests/tests/Bug3.hs create mode 100644 tests/tests/Bug3.html.ref create mode 100644 tests/tests/Bug4.hs create mode 100644 tests/tests/Bug4.html.ref create mode 100644 tests/tests/Bug6.hs create mode 100644 tests/tests/Bug6.html.ref create mode 100644 tests/tests/Bug7.hs create mode 100644 tests/tests/Bug7.html.ref create mode 100644 tests/tests/Bug8.hs create mode 100644 tests/tests/Bug8.html.ref create mode 100644 tests/tests/Bugs.hs create mode 100644 tests/tests/Bugs.html.ref create mode 100644 tests/tests/Hash.hs create mode 100644 tests/tests/Hash.html.ref create mode 100644 tests/tests/Hidden.hs create mode 100644 tests/tests/NoLayout.hs create mode 100644 tests/tests/NoLayout.html.ref create mode 100644 tests/tests/Test.hs create mode 100644 tests/tests/Test.html.ref create mode 100644 tests/tests/TypeOperators.hs create mode 100644 tests/tests/TypeOperators.html.ref create mode 100644 tests/tests/Visible.hs create mode 100644 tests/tests/Visible.html.ref diff --git a/tests/copy.hs b/tests/copy.hs new file mode 100644 index 00000000..e69de29b diff --git a/tests/extensions/TypeOperators.hs b/tests/extensions/TypeOperators.hs deleted file mode 100644 index aa0fbe8c..00000000 --- a/tests/extensions/TypeOperators.hs +++ /dev/null @@ -1,22 +0,0 @@ -module TypeOperators ( - -- * stuff - (:-:), - (:+:), - Op, - O(..), - biO, - Flip(..) -) where - -data a :-: b - -data (a :+: b) c - -data a `Op` b - -newtype (g `O` f) a = O { unO :: g (f a) } - -biO :: (g `O` f) a -biO = undefined - -newtype Flip (~>) b a = Flip { unFlip :: a ~> b } diff --git a/tests/extensions/TypeOperators.html.ref b/tests/extensions/TypeOperators.html.ref deleted file mode 100644 index 1094536f..00000000 --- a/tests/extensions/TypeOperators.html.ref +++ /dev/null @@ -1,380 +0,0 @@ - - -TypeOperators
 ContentsIndex
TypeOperators
Contents
stuff -
Synopsis
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a = O {
unO :: g (f a)
}
biO :: (g `O` f) a
newtype Flip (~>) b a = Flip {
unFlip :: a ~> b
}
stuff -
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a
Constructors
O
unO :: g (f a)
biO :: (g `O` f) a
newtype Flip (~>) b a
Constructors
Flip
unFlip :: a ~> b
Produced by Haddock version 2.0.0.0
diff --git a/tests/output/A.html b/tests/output/A.html new file mode 100644 index 00000000..3a3c137b --- /dev/null +++ b/tests/output/A.html @@ -0,0 +1,116 @@ + + +A
 ContentsIndex
A
Documentation
data A
Constructors
A
Produced by Haddock version 2.1.0
diff --git a/tests/output/A.html.ref b/tests/output/A.html.ref new file mode 100644 index 00000000..3a3c137b --- /dev/null +++ b/tests/output/A.html.ref @@ -0,0 +1,116 @@ + + +A
 ContentsIndex
A
Documentation
data A
Constructors
A
Produced by Haddock version 2.1.0
diff --git a/tests/output/B.html b/tests/output/B.html new file mode 100644 index 00000000..a69e45ad --- /dev/null +++ b/tests/output/B.html @@ -0,0 +1,86 @@ + + +B
 ContentsIndex
B
Documentation
module A
Produced by Haddock version 2.1.0
diff --git a/tests/output/B.html.ref b/tests/output/B.html.ref new file mode 100644 index 00000000..a69e45ad --- /dev/null +++ b/tests/output/B.html.ref @@ -0,0 +1,86 @@ + + +B
 ContentsIndex
B
Documentation
module A
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug1.html b/tests/output/Bug1.html new file mode 100644 index 00000000..462f088b --- /dev/null +++ b/tests/output/Bug1.html @@ -0,0 +1,150 @@ + + +Bug1
 ContentsIndex
Bug1
Synopsis
data T = T
Documentation
data T
We should have different anchors for constructors and types/classes. This + hyperlink should point to the type constructor by default: T. +
Constructors
T
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug1.html.ref b/tests/output/Bug1.html.ref new file mode 100644 index 00000000..462f088b --- /dev/null +++ b/tests/output/Bug1.html.ref @@ -0,0 +1,150 @@ + + +Bug1
 ContentsIndex
Bug1
Synopsis
data T = T
Documentation
data T
We should have different anchors for constructors and types/classes. This + hyperlink should point to the type constructor by default: T. +
Constructors
T
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug2.html b/tests/output/Bug2.html new file mode 100644 index 00000000..aa9d6647 --- /dev/null +++ b/tests/output/Bug2.html @@ -0,0 +1,90 @@ + + +Bug2
 ContentsIndex
Bug2
Documentation
x :: A
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug2.html.ref b/tests/output/Bug2.html.ref new file mode 100644 index 00000000..aa9d6647 --- /dev/null +++ b/tests/output/Bug2.html.ref @@ -0,0 +1,90 @@ + + +Bug2
 ContentsIndex
Bug2
Documentation
x :: A
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug3.html b/tests/output/Bug3.html new file mode 100644 index 00000000..60f4b890 --- /dev/null +++ b/tests/output/Bug3.html @@ -0,0 +1,114 @@ + + +Bug3
 ContentsIndex
Bug3
Synopsis
foo :: Int
Documentation
foo :: Int
/multi-line + emphasis/ +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug3.html.ref b/tests/output/Bug3.html.ref new file mode 100644 index 00000000..60f4b890 --- /dev/null +++ b/tests/output/Bug3.html.ref @@ -0,0 +1,114 @@ + + +Bug3
 ContentsIndex
Bug3
Synopsis
foo :: Int
Documentation
foo :: Int
/multi-line + emphasis/ +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug4.html b/tests/output/Bug4.html new file mode 100644 index 00000000..c2921742 --- /dev/null +++ b/tests/output/Bug4.html @@ -0,0 +1,113 @@ + + +Bug4
 ContentsIndex
Bug4
Synopsis
foo :: Int
Documentation
foo :: Int
don't use apostrophe's in the wrong place's +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug4.html.ref b/tests/output/Bug4.html.ref new file mode 100644 index 00000000..c2921742 --- /dev/null +++ b/tests/output/Bug4.html.ref @@ -0,0 +1,113 @@ + + +Bug4
 ContentsIndex
Bug4
Synopsis
foo :: Int
Documentation
foo :: Int
don't use apostrophe's in the wrong place's +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug6.html b/tests/output/Bug6.html new file mode 100644 index 00000000..806f5470 --- /dev/null +++ b/tests/output/Bug6.html @@ -0,0 +1,482 @@ + + +Bug6
 ContentsIndex
Bug6
Description
Exporting records. +
Synopsis
data A = A Int
data B = B {
b :: Int
}
b :: B -> Int
data C = C {
c1 :: Int
c2 :: Int
}
data D = D Int Int
newtype E = E Int
Documentation
data A
This record is exported without its field +
Constructors
A Int
data B
.. with its field, but the field is named separately in the export list + (should still be visible as a field name) +
Constructors
B
b :: Int
b :: B -> Int
data C
.. with fields names as subordinate names in the export +
Constructors
C
c1 :: Int
c2 :: Int
data D
.. with only some of the fields exported (we can't handle this one - + how do we render the declaration?) +
Constructors
D Int Int
newtype E
a newtype with a field +
Constructors
E Int
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug6.html.ref b/tests/output/Bug6.html.ref new file mode 100644 index 00000000..806f5470 --- /dev/null +++ b/tests/output/Bug6.html.ref @@ -0,0 +1,482 @@ + + +Bug6
 ContentsIndex
Bug6
Description
Exporting records. +
Synopsis
data A = A Int
data B = B {
b :: Int
}
b :: B -> Int
data C = C {
c1 :: Int
c2 :: Int
}
data D = D Int Int
newtype E = E Int
Documentation
data A
This record is exported without its field +
Constructors
A Int
data B
.. with its field, but the field is named separately in the export list + (should still be visible as a field name) +
Constructors
B
b :: Int
b :: B -> Int
data C
.. with fields names as subordinate names in the export +
Constructors
C
c1 :: Int
c2 :: Int
data D
.. with only some of the fields exported (we can't handle this one - + how do we render the declaration?) +
Constructors
D Int Int
newtype E
a newtype with a field +
Constructors
E Int
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug7.html b/tests/output/Bug7.html new file mode 100644 index 00000000..788ae3a9 --- /dev/null +++ b/tests/output/Bug7.html @@ -0,0 +1,242 @@ + + +Bug7
 ContentsIndex
Bug7
Description
This module caused a duplicate instance in the documentation for the Foo + type. +
Synopsis
data Foo = Foo
class Bar x y
Documentation
data Foo
The Foo datatype +
Constructors
Foo
show/hide Instances
class Bar x y
The Bar class +
show/hide Instances
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug7.html.ref b/tests/output/Bug7.html.ref new file mode 100644 index 00000000..788ae3a9 --- /dev/null +++ b/tests/output/Bug7.html.ref @@ -0,0 +1,242 @@ + + +Bug7
 ContentsIndex
Bug7
Description
This module caused a duplicate instance in the documentation for the Foo + type. +
Synopsis
data Foo = Foo
class Bar x y
Documentation
data Foo
The Foo datatype +
Constructors
Foo
show/hide Instances
class Bar x y
The Bar class +
show/hide Instances
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug8.html b/tests/output/Bug8.html new file mode 100644 index 00000000..d6be9969 --- /dev/null +++ b/tests/output/Bug8.html @@ -0,0 +1,128 @@ + + +Bug8
 ContentsIndex
Bug8
Documentation
data Typ
Constructors
Type (String, [Typ])
TFree (String, [String])
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bug8.html.ref b/tests/output/Bug8.html.ref new file mode 100644 index 00000000..d6be9969 --- /dev/null +++ b/tests/output/Bug8.html.ref @@ -0,0 +1,128 @@ + + +Bug8
 ContentsIndex
Bug8
Documentation
data Typ
Constructors
Type (String, [Typ])
TFree (String, [String])
Produced by Haddock version 2.1.0
diff --git a/tests/output/Bugs.html b/tests/output/Bugs.html new file mode 100644 index 00000000..f9a3522b --- /dev/null +++ b/tests/output/Bugs.html @@ -0,0 +1,116 @@ + + +Bugs
 ContentsIndex
Bugs
Documentation
data A a
Constructors
A a (a -> Int)
Produced by Haddock version 2.1.0
diff --git a/tests/output/Hash.html b/tests/output/Hash.html new file mode 100644 index 00000000..5e03b2ef --- /dev/null +++ b/tests/output/Hash.html @@ -0,0 +1,412 @@ + + +Hash
 ContentsIndex
Hash
Contents
The HashTable type +
Operations on HashTables +
The Hash class +
Description
Implementation of fixed-size hash tables, with a type + class for constructing hash values for structured types. +
Synopsis
data HashTable key val
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
insert :: (Eq key, Hash key) => key -> val -> IO ()
lookup :: Hash key => key -> IO (Maybe val)
class Hash a where
hash :: a -> Int
The HashTable type +
data HashTable key val
A hash table with keys of type key and values of type val. + The type key should be an instance of Eq. +
Operations on HashTables +
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
Builds a new hash table with a given size +
insert :: (Eq key, Hash key) => key -> val -> IO ()
Inserts a new element into the hash table +
lookup :: Hash key => key -> IO (Maybe val)
Looks up a key in the hash table, returns Just val if the key + was found, or Nothing otherwise. +
The Hash class +
class Hash a where
A class of types which can be hashed. +
Methods
hash :: a -> Int
hashes the value of type a into an Int +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Hash.html.ref b/tests/output/Hash.html.ref new file mode 100644 index 00000000..5e03b2ef --- /dev/null +++ b/tests/output/Hash.html.ref @@ -0,0 +1,412 @@ + + +Hash
 ContentsIndex
Hash
Contents
The HashTable type +
Operations on HashTables +
The Hash class +
Description
Implementation of fixed-size hash tables, with a type + class for constructing hash values for structured types. +
Synopsis
data HashTable key val
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
insert :: (Eq key, Hash key) => key -> val -> IO ()
lookup :: Hash key => key -> IO (Maybe val)
class Hash a where
hash :: a -> Int
The HashTable type +
data HashTable key val
A hash table with keys of type key and values of type val. + The type key should be an instance of Eq. +
Operations on HashTables +
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
Builds a new hash table with a given size +
insert :: (Eq key, Hash key) => key -> val -> IO ()
Inserts a new element into the hash table +
lookup :: Hash key => key -> IO (Maybe val)
Looks up a key in the hash table, returns Just val if the key + was found, or Nothing otherwise. +
The Hash class +
class Hash a where
A class of types which can be hashed. +
Methods
hash :: a -> Int
hashes the value of type a into an Int +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Hidden.html.ref b/tests/output/Hidden.html.ref new file mode 100644 index 00000000..2e4acc71 --- /dev/null +++ b/tests/output/Hidden.html.ref @@ -0,0 +1,88 @@ + + +Hidden
 ContentsIndex
Hidden
Documentation
hidden :: Int -> Int
Produced by Haddock version 2.0.0.0
diff --git a/tests/output/NoLayout.html b/tests/output/NoLayout.html new file mode 100644 index 00000000..4709e907 --- /dev/null +++ b/tests/output/NoLayout.html @@ -0,0 +1,113 @@ + + +NoLayout
 ContentsIndex
NoLayout
Synopsis
g :: Int
Documentation
g :: Int
the class C +
Produced by Haddock version 2.1.0
diff --git a/tests/output/NoLayout.html.ref b/tests/output/NoLayout.html.ref new file mode 100644 index 00000000..4709e907 --- /dev/null +++ b/tests/output/NoLayout.html.ref @@ -0,0 +1,113 @@ + + +NoLayout
 ContentsIndex
NoLayout
Synopsis
g :: Int
Documentation
g :: Int
the class C +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Test.html b/tests/output/Test.html new file mode 100644 index 00000000..38df4004 --- /dev/null +++ b/tests/output/Test.html @@ -0,0 +1,3105 @@ + + +Test
 ContentsIndex
Test
Portabilityportable
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
Type declarations +
Data types +
Records +
Class declarations +
Function types +
Auxiliary stuff +
A hidden module +
A visible module +
Existential / Universal types +
Type signatures with argument docs +
A section +
A subsection +
Description
This module illustrates & tests most of the features of Haddock. + Testing references from the description: T, f, g, visible. +
Synopsis
data T a b
= A Int (Maybe Float)
| B (T a b, T Int Float)
data T2 a b
data T3 a b
= A1 a
| B1 b
data T4 a b
= A2 a
| B2 b
data T5 a b
= A3 a
| B3 b
data T6
= A4
| B4
| C4
newtype N1 a = N1 a
newtype N2 a b = N2 {
n :: a b
}
newtype N3 a b = N3 {
n3 :: a b
}
data N4 a b
newtype N5 a b = N5 {
n5 :: a b
}
newtype N6 a b = N6 {
n6 :: a b
}
newtype N7 a b = N7 {
n7 :: a b
}
data R
= C1 {
p :: Int
q :: forall a. a -> a
r :: Int
s :: Int
}
| C2 {
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
}
data R1 = C3 {
s1 :: Int
s2 :: Int
s3 :: Int
}
p :: R -> Int
q :: R -> forall a. a -> a
u :: R -> Int
class D a => C a where
a :: IO a
b :: [a]
class D a where
d :: T a b
e :: (a, a)
class E a
class F a where
ff :: a
a :: C a => IO a
f :: C a => a -> Int
g :: Int -> IO CInt
hidden :: Int -> Int
module Visible
data Ex a
= forall b . C b => Ex1 b
| forall b . Ex2 b
| forall b . C a => Ex3 b
| Ex4 (forall a. a -> a)
k :: T () () -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 () () -> IO ()
l :: (Int, Int, Float) -> Int
m :: R -> N1 () -> IO Int
o :: Float -> IO Float
f' :: Int
Type declarations +
Data types +
data T a b
This comment applies to the following declaration + and it continues until the next non-comment line +
Constructors
A Int (Maybe Float)This comment describes the A constructor +
B (T a b, T Int Float)This comment describes the B constructor +
data T2 a b
An abstract data declaration +
data T3 a b
A data declaration with no documentation annotations on the constructors +
Constructors
A1 a
B1 b
data T4 a b
Constructors
A2 a
B2 b
data T5 a b
Constructors
A3 adocuments A3 +
B3 bdocuments B3 +
data T6
Testing alternative comment styles +
Constructors
A4This is the doc for A4 +
B4This is the doc for B4 +
C4This is the doc for C4 +
newtype N1 a
A newtype +
Constructors
N1 a
newtype N2 a b
A newtype with a fieldname +
Constructors
N2
n :: a b
newtype N3 a b
A newtype with a fieldname, documentation on the field +
Constructors
N3
n3 :: a bthis is the n3 field +
data N4 a b
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
Constructors
N5
n5 :: a bno docs on the datatype or the constructor +
newtype N6 a b
Constructors
N6docs on the constructor only +
n6 :: a b
newtype N7 a b
docs on the newtype and the constructor +
Constructors
N7The N7 constructor +
n7 :: a b
Records +
data R
This is the documentation for the R record, which has four fields, + p, q, r, and s. +
Constructors
C1This is the C1 record constructor, with the following fields: +
p :: IntThis comment applies to the p field +
q :: forall a. a -> aThis comment applies to the q field +
r :: IntThis comment applies to both r and s +
s :: IntThis comment applies to both r and s +
C2This is the C2 record constructor, also with some fields: +
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
data R1
Testing different record commenting styles +
Constructors
C3This is the C3 record constructor +
s1 :: IntThe s1 record selector +
s2 :: IntThe s2 record selector +
s3 :: IntThe s3 record selector +
test that we can export record selectors on their own: +
p :: R -> Int
This comment applies to the p field +
q :: R -> forall a. a -> a
This comment applies to the q field +
u :: R -> Int
Class declarations +
class D a => C a where
This comment applies to the previous declaration (the C class) +
Methods
a :: IO a
this is a description of the a method +
b :: [a]
this is a description of the b method +
class D a where
This is a class declaration with no separate docs for the methods +
Methods
d :: T a b
e :: (a, a)
class E a
This is a class declaration with no methods (or no methods exported) +
class F a where
Methods
ff :: a
Test that we can export a class method on its own: +
a :: C a => IO a
this is a description of the a method +
Function types +
f :: C a => a -> Int

In a comment string we can refer to identifiers in scope with +single quotes like this: 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) +

+     This is a block of code, which can include other markup: R
+     formatting
+               is
+                 significant
+
 this is another block of code
+

We can also include URLs in documentation: http://www.haskell.org/. +

g :: Int -> IO CInt
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. +

 code block in named doc
This is some documentation that is attached to a name ($aux2) +
 code block on its own in named doc
 code block on its own in named doc (after newline)

a nested, named doc comment +

with a paragraph, +

 and a code block
test
+test1
+
 test2
+  test3
+
+test1
+test2
+
test3
+test4
+
+test1
+test2
+
test3
+test4
+
test3
+test4
+
+test1
+test2
+

aux11: +

test3
+test4
+
+test1
+test2
+
 foo
+
 bar
+

This is some inline documentation in the export list +

 a code block using bird-tracks
+ each line must begin with > (which isn't significant unless it
+ is at the beginning of the line).
+
A hidden module +
hidden :: Int -> Int
A visible module +
module Visible
nested-style doc comments +
Existential / Universal types +
data Ex a
A data-type using existential/universal types +
Constructors
forall b . C b => Ex1 b
forall b . Ex2 b
forall b . C a => Ex3 b
Ex4 (forall a. a -> a)
Type signatures with argument docs +
k
:: T () ()This argument has type T +
-> T2 Int IntThis argument has type 'T2 Int Int' +
-> T3 Bool Bool -> T4 Float FloatThis argument has type T3 Bool Bool -> T4 Float Float +
-> 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. +
-> IO ()This is the result type +
This is a function with documentation for each argument +
l
:: (Int, Int, Float)takes a triple +
-> Intreturns an Int +
m
:: R
-> N1 ()one of the arguments +
-> IO Intand the return value +
This function has some arg docs +
o
:: FloatThe input float +
-> IO FloatThe output float +
A foreign import with argument docs +
A section +
A subsection +
 a literal line
+

$ a non literal line $ +

f' :: Int
a function with a prime can be referred to as f' + but f' doesn't get link'd 'f\'' +
Produced by Haddock version 2.1.0
diff --git a/tests/output/Test.html.ref b/tests/output/Test.html.ref new file mode 100644 index 00000000..38df4004 --- /dev/null +++ b/tests/output/Test.html.ref @@ -0,0 +1,3105 @@ + + +Test
 ContentsIndex
Test
Portabilityportable
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
Type declarations +
Data types +
Records +
Class declarations +
Function types +
Auxiliary stuff +
A hidden module +
A visible module +
Existential / Universal types +
Type signatures with argument docs +
A section +
A subsection +
Description
This module illustrates & tests most of the features of Haddock. + Testing references from the description: T, f, g, visible. +
Synopsis
data T a b
= A Int (Maybe Float)
| B (T a b, T Int Float)
data T2 a b
data T3 a b
= A1 a
| B1 b
data T4 a b
= A2 a
| B2 b
data T5 a b
= A3 a
| B3 b
data T6
= A4
| B4
| C4
newtype N1 a = N1 a
newtype N2 a b = N2 {
n :: a b
}
newtype N3 a b = N3 {
n3 :: a b
}
data N4 a b
newtype N5 a b = N5 {
n5 :: a b
}
newtype N6 a b = N6 {
n6 :: a b
}
newtype N7 a b = N7 {
n7 :: a b
}
data R
= C1 {
p :: Int
q :: forall a. a -> a
r :: Int
s :: Int
}
| C2 {
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
}
data R1 = C3 {
s1 :: Int
s2 :: Int
s3 :: Int
}
p :: R -> Int
q :: R -> forall a. a -> a
u :: R -> Int
class D a => C a where
a :: IO a
b :: [a]
class D a where
d :: T a b
e :: (a, a)
class E a
class F a where
ff :: a
a :: C a => IO a
f :: C a => a -> Int
g :: Int -> IO CInt
hidden :: Int -> Int
module Visible
data Ex a
= forall b . C b => Ex1 b
| forall b . Ex2 b
| forall b . C a => Ex3 b
| Ex4 (forall a. a -> a)
k :: T () () -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 () () -> IO ()
l :: (Int, Int, Float) -> Int
m :: R -> N1 () -> IO Int
o :: Float -> IO Float
f' :: Int
Type declarations +
Data types +
data T a b
This comment applies to the following declaration + and it continues until the next non-comment line +
Constructors
A Int (Maybe Float)This comment describes the A constructor +
B (T a b, T Int Float)This comment describes the B constructor +
data T2 a b
An abstract data declaration +
data T3 a b
A data declaration with no documentation annotations on the constructors +
Constructors
A1 a
B1 b
data T4 a b
Constructors
A2 a
B2 b
data T5 a b
Constructors
A3 adocuments A3 +
B3 bdocuments B3 +
data T6
Testing alternative comment styles +
Constructors
A4This is the doc for A4 +
B4This is the doc for B4 +
C4This is the doc for C4 +
newtype N1 a
A newtype +
Constructors
N1 a
newtype N2 a b
A newtype with a fieldname +
Constructors
N2
n :: a b
newtype N3 a b
A newtype with a fieldname, documentation on the field +
Constructors
N3
n3 :: a bthis is the n3 field +
data N4 a b
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
Constructors
N5
n5 :: a bno docs on the datatype or the constructor +
newtype N6 a b
Constructors
N6docs on the constructor only +
n6 :: a b
newtype N7 a b
docs on the newtype and the constructor +
Constructors
N7The N7 constructor +
n7 :: a b
Records +
data R
This is the documentation for the R record, which has four fields, + p, q, r, and s. +
Constructors
C1This is the C1 record constructor, with the following fields: +
p :: IntThis comment applies to the p field +
q :: forall a. a -> aThis comment applies to the q field +
r :: IntThis comment applies to both r and s +
s :: IntThis comment applies to both r and s +
C2This is the C2 record constructor, also with some fields: +
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
data R1
Testing different record commenting styles +
Constructors
C3This is the C3 record constructor +
s1 :: IntThe s1 record selector +
s2 :: IntThe s2 record selector +
s3 :: IntThe s3 record selector +
test that we can export record selectors on their own: +
p :: R -> Int
This comment applies to the p field +
q :: R -> forall a. a -> a
This comment applies to the q field +
u :: R -> Int
Class declarations +
class D a => C a where
This comment applies to the previous declaration (the C class) +
Methods
a :: IO a
this is a description of the a method +
b :: [a]
this is a description of the b method +
class D a where
This is a class declaration with no separate docs for the methods +
Methods
d :: T a b
e :: (a, a)
class E a
This is a class declaration with no methods (or no methods exported) +
class F a where
Methods
ff :: a
Test that we can export a class method on its own: +
a :: C a => IO a
this is a description of the a method +
Function types +
f :: C a => a -> Int

In a comment string we can refer to identifiers in scope with +single quotes like this: 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) +

+     This is a block of code, which can include other markup: R
+     formatting
+               is
+                 significant
+
 this is another block of code
+

We can also include URLs in documentation: http://www.haskell.org/. +

g :: Int -> IO CInt
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. +

 code block in named doc
This is some documentation that is attached to a name ($aux2) +
 code block on its own in named doc
 code block on its own in named doc (after newline)

a nested, named doc comment +

with a paragraph, +

 and a code block
test
+test1
+
 test2
+  test3
+
+test1
+test2
+
test3
+test4
+
+test1
+test2
+
test3
+test4
+
test3
+test4
+
+test1
+test2
+

aux11: +

test3
+test4
+
+test1
+test2
+
 foo
+
 bar
+

This is some inline documentation in the export list +

 a code block using bird-tracks
+ each line must begin with > (which isn't significant unless it
+ is at the beginning of the line).
+
A hidden module +
hidden :: Int -> Int
A visible module +
module Visible
nested-style doc comments +
Existential / Universal types +
data Ex a
A data-type using existential/universal types +
Constructors
forall b . C b => Ex1 b
forall b . Ex2 b
forall b . C a => Ex3 b
Ex4 (forall a. a -> a)
Type signatures with argument docs +
k
:: T () ()This argument has type T +
-> T2 Int IntThis argument has type 'T2 Int Int' +
-> T3 Bool Bool -> T4 Float FloatThis argument has type T3 Bool Bool -> T4 Float Float +
-> 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. +
-> IO ()This is the result type +
This is a function with documentation for each argument +
l
:: (Int, Int, Float)takes a triple +
-> Intreturns an Int +
m
:: R
-> N1 ()one of the arguments +
-> IO Intand the return value +
This function has some arg docs +
o
:: FloatThe input float +
-> IO FloatThe output float +
A foreign import with argument docs +
A section +
A subsection +
 a literal line
+

$ a non literal line $ +

f' :: Int
a function with a prime can be referred to as f' + but f' doesn't get link'd 'f\'' +
Produced by Haddock version 2.1.0
diff --git a/tests/output/TypeOperators.html b/tests/output/TypeOperators.html new file mode 100644 index 00000000..9c0149dd --- /dev/null +++ b/tests/output/TypeOperators.html @@ -0,0 +1,380 @@ + + +TypeOperators
 ContentsIndex
TypeOperators
Contents
stuff +
Synopsis
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a = O {
unO :: g (f a)
}
biO :: (g `O` f) a
newtype Flip (~>) b a = Flip {
unFlip :: a ~> b
}
stuff +
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a
Constructors
O
unO :: g (f a)
biO :: (g `O` f) a
newtype Flip (~>) b a
Constructors
Flip
unFlip :: a ~> b
Produced by Haddock version 2.1.0
diff --git a/tests/output/TypeOperators.html.ref b/tests/output/TypeOperators.html.ref new file mode 100644 index 00000000..9c0149dd --- /dev/null +++ b/tests/output/TypeOperators.html.ref @@ -0,0 +1,380 @@ + + +TypeOperators
 ContentsIndex
TypeOperators
Contents
stuff +
Synopsis
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a = O {
unO :: g (f a)
}
biO :: (g `O` f) a
newtype Flip (~>) b a = Flip {
unFlip :: a ~> b
}
stuff +
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a
Constructors
O
unO :: g (f a)
biO :: (g `O` f) a
newtype Flip (~>) b a
Constructors
Flip
unFlip :: a ~> b
Produced by Haddock version 2.1.0
diff --git a/tests/output/Visible.html b/tests/output/Visible.html new file mode 100644 index 00000000..9ed7f264 --- /dev/null +++ b/tests/output/Visible.html @@ -0,0 +1,88 @@ + + +Visible
 ContentsIndex
Visible
Documentation
visible :: Int -> Int
Produced by Haddock version 2.1.0
diff --git a/tests/output/Visible.html.ref b/tests/output/Visible.html.ref new file mode 100644 index 00000000..9ed7f264 --- /dev/null +++ b/tests/output/Visible.html.ref @@ -0,0 +1,88 @@ + + +Visible
 ContentsIndex
Visible
Documentation
visible :: Int -> Int
Produced by Haddock version 2.1.0
diff --git a/tests/output/doc-index.html b/tests/output/doc-index.html new file mode 100644 index 00000000..95a06336 --- /dev/null +++ b/tests/output/doc-index.html @@ -0,0 +1,1104 @@ + + + (Index)
 ContentsIndex
Search:
--->
-->
:+:
:-:
A
1 (Type/Class)
2 (Data Constructor)
3 (Type/Class)
4 (Data Constructor)
5 (Data Constructor)
6 (Type/Class)
7 (Data Constructor)
a
A1
A2
A3
A4
B
1 (Type/Class)
2 (Data Constructor)
3 (Data Constructor)
b
1 (Function)
2 (Function)
B1
B2
B3
B4
Bar
biO
C
1 (Type/Class)
2 (Data Constructor)
3 (Type/Class)
C1
c1
C2
c2
C3
C4
D
1 (Type/Class)
2 (Data Constructor)
3 (Type/Class)
d
d1
E
1 (Type/Class)
2 (Data Constructor)
3 (Type/Class)
e
Ex
Ex1
Ex2
Ex3
Ex4
F
f
f'
ff
Flip
1 (Type/Class)
2 (Data Constructor)
Foo
1 (Type/Class)
2 (Data Constructor)
foo
1 (Function)
2 (Function)
g
1 (Function)
2 (Function)
Hash
hash
HashTable
hidden
insert
k
l
lookup
m
main
n
N1
1 (Type/Class)
2 (Data Constructor)
N2
1 (Type/Class)
2 (Data Constructor)
N3
1 (Type/Class)
2 (Data Constructor)
n3
N4
N5
1 (Type/Class)
2 (Data Constructor)
n5
N6
1 (Type/Class)
2 (Data Constructor)
n6
N7
1 (Type/Class)
2 (Data Constructor)
n7
new
O
1 (Type/Class)
2 (Data Constructor)
o
Op
p
q
R
r
R1
s
1 (Function)
2 (Function)
s1
s2
s3
T
1 (Type/Class)
2 (Data Constructor)
3 (Type/Class)
t
1 (Function)
2 (Function)
T2
T3
T4
T5
T6
TFree
Typ
Type
u
unFlip
unO
v
visible
x
diff --git a/tests/output/index.html b/tests/output/index.html new file mode 100644 index 00000000..6210c6e3 --- /dev/null +++ b/tests/output/index.html @@ -0,0 +1,208 @@ + + +
 ContentsIndex
Modules
A
B
Bug1
Bug2
Bug3
Bug4
Bug6
Bug7
Bug8
Bugs
Hash
NoLayout
Test
TypeOperators
Visible
Produced by Haddock version 2.1.0
diff --git a/tests/pre-2.0-tests/A.hs b/tests/pre-2.0-tests/A.hs deleted file mode 100644 index 4a344a24..00000000 --- a/tests/pre-2.0-tests/A.hs +++ /dev/null @@ -1,2 +0,0 @@ -module A where -data A = A diff --git a/tests/pre-2.0-tests/A.html.ref b/tests/pre-2.0-tests/A.html.ref deleted file mode 100644 index 598bf23c..00000000 --- a/tests/pre-2.0-tests/A.html.ref +++ /dev/null @@ -1,116 +0,0 @@ - - -A
 ContentsIndex
A
Documentation
data A
Constructors
A
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/B.hs b/tests/pre-2.0-tests/B.hs deleted file mode 100644 index 3a31507e..00000000 --- a/tests/pre-2.0-tests/B.hs +++ /dev/null @@ -1,2 +0,0 @@ -module B ( module A ) where -import A diff --git a/tests/pre-2.0-tests/B.html.ref b/tests/pre-2.0-tests/B.html.ref deleted file mode 100644 index 8ff0218d..00000000 --- a/tests/pre-2.0-tests/B.html.ref +++ /dev/null @@ -1,86 +0,0 @@ - - -B
 ContentsIndex
B
Documentation
module A
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Bug1.hs b/tests/pre-2.0-tests/Bug1.hs deleted file mode 100644 index af1ed4d3..00000000 --- a/tests/pre-2.0-tests/Bug1.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Bug1 where - --- | We should have different anchors for constructors and types\/classes. This --- hyperlink should point to the type constructor by default: 'T'. -data T = T - diff --git a/tests/pre-2.0-tests/Bug1.html.ref b/tests/pre-2.0-tests/Bug1.html.ref deleted file mode 100644 index 7160bdaf..00000000 --- a/tests/pre-2.0-tests/Bug1.html.ref +++ /dev/null @@ -1,150 +0,0 @@ - - -Bug1
 ContentsIndex
Bug1
Synopsis
data T = T
Documentation
data T
We should have different anchors for constructors and types/classes. This - hyperlink should point to the type constructor by default: T. -
Constructors
T
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Bug2.hs b/tests/pre-2.0-tests/Bug2.hs deleted file mode 100644 index 9121922e..00000000 --- a/tests/pre-2.0-tests/Bug2.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Bug2 ( x ) where -import B -x :: A -x = A diff --git a/tests/pre-2.0-tests/Bug2.html.ref b/tests/pre-2.0-tests/Bug2.html.ref deleted file mode 100644 index d06e84ee..00000000 --- a/tests/pre-2.0-tests/Bug2.html.ref +++ /dev/null @@ -1,90 +0,0 @@ - - -Bug2
 ContentsIndex
Bug2
Documentation
x :: A
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Bug3.hs b/tests/pre-2.0-tests/Bug3.hs deleted file mode 100644 index 67e57892..00000000 --- a/tests/pre-2.0-tests/Bug3.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Bug3 where - --- | /multi-line --- emphasis/ -foo :: Int -foo = undefined diff --git a/tests/pre-2.0-tests/Bug3.html.ref b/tests/pre-2.0-tests/Bug3.html.ref deleted file mode 100644 index a5a03f3d..00000000 --- a/tests/pre-2.0-tests/Bug3.html.ref +++ /dev/null @@ -1,114 +0,0 @@ - - -Bug3
 ContentsIndex
Bug3
Synopsis
foo :: Int
Documentation
foo :: Int
/multi-line - emphasis/ -
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Bug4.hs b/tests/pre-2.0-tests/Bug4.hs deleted file mode 100644 index 425a77aa..00000000 --- a/tests/pre-2.0-tests/Bug4.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Bug4 where --- | don't use apostrophe's in the wrong place's -foo :: Int -foo = undefined - diff --git a/tests/pre-2.0-tests/Bug4.html.ref b/tests/pre-2.0-tests/Bug4.html.ref deleted file mode 100644 index 75a0b740..00000000 --- a/tests/pre-2.0-tests/Bug4.html.ref +++ /dev/null @@ -1,113 +0,0 @@ - - -Bug4
 ContentsIndex
Bug4
Synopsis
foo :: Int
Documentation
foo :: Int
don't use apostrophe's in the wrong place's -
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Bug6.hs b/tests/pre-2.0-tests/Bug6.hs deleted file mode 100644 index 498983df..00000000 --- a/tests/pre-2.0-tests/Bug6.hs +++ /dev/null @@ -1,23 +0,0 @@ --- | Exporting records. -module Bug6( A(A), B(B), b, C(C,c1,c2), D(D,d1), E(E) ) where - --- | --- This record is exported without its field -data A = A { a :: Int } - --- | --- .. with its field, but the field is named separately in the export list --- (should still be visible as a field name) -data B = B { b :: Int } - --- | --- .. with fields names as subordinate names in the export -data C = C { c1 :: Int, c2 :: Int } - --- | --- .. with only some of the fields exported (we can't handle this one - --- how do we render the declaration?) -data D = D { d1 :: Int, d2 :: Int } - --- | a newtype with a field -newtype E = E { e :: Int } diff --git a/tests/pre-2.0-tests/Bug6.html.ref b/tests/pre-2.0-tests/Bug6.html.ref deleted file mode 100644 index 7fe93681..00000000 --- a/tests/pre-2.0-tests/Bug6.html.ref +++ /dev/null @@ -1,482 +0,0 @@ - - -Bug6
 ContentsIndex
Bug6
Description
Exporting records. -
Synopsis
data A = A Int
data B = B {
b :: Int
}
b :: B -> Int
data C = C {
c1 :: Int
c2 :: Int
}
data D = D Int Int
newtype E = E Int
Documentation
data A
This record is exported without its field -
Constructors
A Int
data B
.. with its field, but the field is named separately in the export list - (should still be visible as a field name) -
Constructors
B
b :: Int
b :: B -> Int
data C
.. with fields names as subordinate names in the export -
Constructors
C
c1 :: Int
c2 :: Int
data D
.. with only some of the fields exported (we can't handle this one - - how do we render the declaration?) -
Constructors
D Int Int
newtype E
a newtype with a field -
Constructors
E Int
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Bug7.hs b/tests/pre-2.0-tests/Bug7.hs deleted file mode 100644 index 8cf57914..00000000 --- a/tests/pre-2.0-tests/Bug7.hs +++ /dev/null @@ -1,12 +0,0 @@ --- | This module caused a duplicate instance in the documentation for the Foo --- type. -module Bug7 where - --- | The Foo datatype -data Foo = Foo - --- | The Bar class -class Bar x y - --- | Just one instance -instance Bar Foo Foo diff --git a/tests/pre-2.0-tests/Bug7.html.ref b/tests/pre-2.0-tests/Bug7.html.ref deleted file mode 100644 index d2014754..00000000 --- a/tests/pre-2.0-tests/Bug7.html.ref +++ /dev/null @@ -1,242 +0,0 @@ - - -Bug7
 ContentsIndex
Bug7
Description
This module caused a duplicate instance in the documentation for the Foo - type. -
Synopsis
data Foo = Foo
class Bar x y
Documentation
data Foo
The Foo datatype -
Constructors
Foo
show/hide Instances
class Bar x y
The Bar class -
show/hide Instances
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Bug8.hs b/tests/pre-2.0-tests/Bug8.hs deleted file mode 100644 index 0f279c29..00000000 --- a/tests/pre-2.0-tests/Bug8.hs +++ /dev/null @@ -1,17 +0,0 @@ -{- Note that declarations without type signatures are not included in the - documentation. They could be, but that's a missing feature. -} - -module Bug8 where - -infix --> -infix ---> - -data Typ = Type (String,[Typ]) - | TFree (String, [String]) - -x --> y = Type("fun",[s,t]) -(--->) = flip $ foldr (-->) - -s = undefined -t = undefined -main = undefined diff --git a/tests/pre-2.0-tests/Bug8.html.ref b/tests/pre-2.0-tests/Bug8.html.ref deleted file mode 100644 index 34a57f14..00000000 --- a/tests/pre-2.0-tests/Bug8.html.ref +++ /dev/null @@ -1,128 +0,0 @@ - - -Bug8
 ContentsIndex
Bug8
Documentation
data Typ
Constructors
Type (String, [Typ])
TFree (String, [String])
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Hash.hs b/tests/pre-2.0-tests/Hash.hs deleted file mode 100644 index 7d6506f9..00000000 --- a/tests/pre-2.0-tests/Hash.hs +++ /dev/null @@ -1,51 +0,0 @@ -{- | - Implementation of fixed-size hash tables, with a type - class for constructing hash values for structured types. --} -module Hash ( - -- * The @HashTable@ type - HashTable, - - -- ** Operations on @HashTable@s - new, insert, lookup, - - -- * The @Hash@ class - Hash(..), - ) where - -import Array -import Prelude hiding (lookup) - --- | A hash table with keys of type @key@ and values of type @val@. --- The type @key@ should be an instance of 'Eq'. -data HashTable key val = HashTable Int (Array Int [(key,val)]) - --- | Builds a new hash table with a given size -new :: (Eq key, Hash key) => Int -> IO (HashTable key val) -new = undefined - --- | Inserts a new element into the hash table -insert :: (Eq key, Hash key) => key -> val -> IO () -insert = undefined - --- | Looks up a key in the hash table, returns @'Just' val@ if the key --- was found, or 'Nothing' otherwise. -lookup :: Hash key => key -> IO (Maybe val) -lookup = undefined - --- | A class of types which can be hashed. -class Hash a where - -- | hashes the value of type @a@ into an 'Int' - hash :: a -> Int - -instance Hash Int where - hash = id - -instance Hash Float where - hash = trunc - -instance (Hash a, Hash b) => Hash (a,b) where - hash (a,b) = hash a `xor` hash b - -trunc = undefined -xor = undefined diff --git a/tests/pre-2.0-tests/Hash.html.ref b/tests/pre-2.0-tests/Hash.html.ref deleted file mode 100644 index c1034171..00000000 --- a/tests/pre-2.0-tests/Hash.html.ref +++ /dev/null @@ -1,412 +0,0 @@ - - -Hash
 ContentsIndex
Hash
Contents
The HashTable type -
Operations on HashTables -
The Hash class -
Description
Implementation of fixed-size hash tables, with a type - class for constructing hash values for structured types. -
Synopsis
data HashTable key val
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
insert :: (Eq key, Hash key) => key -> val -> IO ()
lookup :: Hash key => key -> IO (Maybe val)
class Hash a where
hash :: a -> Int
The HashTable type -
data HashTable key val
A hash table with keys of type key and values of type val. - The type key should be an instance of Eq. -
Operations on HashTables -
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
Builds a new hash table with a given size -
insert :: (Eq key, Hash key) => key -> val -> IO ()
Inserts a new element into the hash table -
lookup :: Hash key => key -> IO (Maybe val)
Looks up a key in the hash table, returns Just val if the key - was found, or Nothing otherwise. -
The Hash class -
class Hash a where
A class of types which can be hashed. -
Methods
hash :: a -> Int
hashes the value of type a into an Int -
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Hidden.hs b/tests/pre-2.0-tests/Hidden.hs deleted file mode 100644 index e46fc37f..00000000 --- a/tests/pre-2.0-tests/Hidden.hs +++ /dev/null @@ -1,4 +0,0 @@ -{-# OPTIONS_HADDOCK hide #-} -module Hidden where -hidden :: Int -> Int -hidden a = a diff --git a/tests/pre-2.0-tests/Hidden.html.ref b/tests/pre-2.0-tests/Hidden.html.ref deleted file mode 100644 index 2e4acc71..00000000 --- a/tests/pre-2.0-tests/Hidden.html.ref +++ /dev/null @@ -1,88 +0,0 @@ - - -Hidden
 ContentsIndex
Hidden
Documentation
hidden :: Int -> Int
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/NoLayout.hs b/tests/pre-2.0-tests/NoLayout.hs deleted file mode 100644 index ac8e58bb..00000000 --- a/tests/pre-2.0-tests/NoLayout.hs +++ /dev/null @@ -1,12 +0,0 @@ - --- Haddock comments are parsed as separate declarations so we --- need to insert a ';' when using them with explicit layout. --- This should probably be changed. - -module NoLayout where { - -- | the class 'C' - ; - g :: Int; - g = undefined - } - diff --git a/tests/pre-2.0-tests/NoLayout.html.ref b/tests/pre-2.0-tests/NoLayout.html.ref deleted file mode 100644 index b0a862cc..00000000 --- a/tests/pre-2.0-tests/NoLayout.html.ref +++ /dev/null @@ -1,113 +0,0 @@ - - -NoLayout
 ContentsIndex
NoLayout
Synopsis
g :: Int
Documentation
g :: Int
the class C -
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Test.hs b/tests/pre-2.0-tests/Test.hs deleted file mode 100644 index 230f32d8..00000000 --- a/tests/pre-2.0-tests/Test.hs +++ /dev/null @@ -1,410 +0,0 @@ ------------------------------------------------------------------------------ --- | --- Module : Test --- Copyright : (c) Simon Marlow 2002 --- License : BSD-style --- --- Maintainer : libraries@haskell.org --- Stability : provisional --- Portability : portable --- --- This module illustrates & tests most of the features of Haddock. --- Testing references from the description: 'T', 'f', 'g', 'Visible.visible'. --- ------------------------------------------------------------------------------ - --- This is plain comment, ignored by Haddock. - -module Test ( - - -- Section headings are introduced with '-- *': - -- * Type declarations - - -- Subsection headings are introduced with '-- **' and so on. - -- ** Data types - T(..), T2, T3(..), T4(..), T5(..), T6(..), - N1(..), N2(..), N3(..), N4, N5(..), N6(..), N7(..), - - -- ** Records - R(..), R1(..), - - -- | test that we can export record selectors on their own: - p, q, u, - - -- * Class declarations - C(a,b), D(..), E, F(..), - - -- | Test that we can export a class method on its own: - a, - - -- * Function types - f, g, - - -- * Auxiliary stuff - - -- $aux1 - - -- $aux2 - - -- $aux3 - - -- $aux4 - - -- $aux5 - - -- $aux6 - - -- $aux7 - - -- $aux8 - - -- $aux9 - - -- $aux10 - - -- $aux11 - - -- $aux12 - - -- | This is some inline documentation in the export list - -- - -- > a code block using bird-tracks - -- > each line must begin with > (which isn't significant unless it - -- > is at the beginning of the line). - - -- * A hidden module - module Hidden, - - -- * A visible module - module Visible, - - {-| nested-style doc comments -} - - -- * Existential \/ Universal types - Ex(..), - - -- * Type signatures with argument docs - k, l, m, o, - - -- * A section - -- and without an intervening comma: - -- ** A subsection - -{-| - > a literal line - - $ a non /literal/ line $ --} - - f' - ) where - -import Hidden -import Visible -import Data.Maybe - -bla = Nothing - --- | This comment applies to the /following/ declaration --- and it continues until the next non-comment line -data T a b - = A Int (Maybe Float) -- ^ This comment describes the 'A' constructor - | -- | This comment describes the 'B' constructor - B (T a b, T Int Float) -- ^ - --- | An abstract data declaration -data T2 a b = T2 a b - --- | A data declaration with no documentation annotations on the constructors -data T3 a b = A1 a | B1 b - --- A data declaration with no documentation annotations at all -data T4 a b = A2 a | B2 b - --- A data declaration documentation on the constructors only -data T5 a b - = A3 a -- ^ documents 'A3' - | B3 b -- ^ documents 'B3' - --- | Testing alternative comment styles -data T6 - -- | This is the doc for 'A4' - = A4 - | B4 - | -- ^ This is the doc for 'B4' - - -- | This is the doc for 'C4' - C4 - --- | A newtype -newtype N1 a = N1 a - --- | A newtype with a fieldname -newtype N2 a b = N2 {n :: a b} - --- | A newtype with a fieldname, documentation on the field -newtype N3 a b = N3 {n3 :: a b -- ^ this is the 'n3' field - } - --- | 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 N4 a b = N4 a - -newtype N5 a b = N5 {n5 :: a b -- ^ no docs on the datatype or the constructor - } - -newtype N6 a b = N6 {n6 :: a b - } - -- ^ docs on the constructor only - --- | docs on the newtype and the constructor -newtype N7 a b = N7 {n7 :: a b - } - -- ^ The 'N7' constructor - - -class (D a) => C a where - -- |this is a description of the 'a' method - a :: IO a - b :: [a] - -- ^ this is a description of the 'b' method - c :: a -- c is hidden in the export list - --- ^ This comment applies to the /previous/ declaration (the 'C' class) - -class D a where - d :: T a b - e :: (a,a) --- ^ This is a class declaration with no separate docs for the methods - -instance D Int where - d = undefined - e = undefined - --- instance with a qualified class name -instance Test.D Float where - d = undefined - e = undefined - -class E a where - ee :: a --- ^ This is a class declaration with no methods (or no methods exported) - --- This is a class declaration with no documentation at all -class F a where - ff :: a - --- | This is the documentation for the 'R' record, which has four fields, --- 'p', 'q', 'r', and 's'. -data R = - -- | This is the 'C1' record constructor, with the following fields: - C1 { p :: Int -- ^ This comment applies to the 'p' field - , q :: forall a . a->a -- ^ This comment applies to the 'q' field - , -- | This comment applies to both 'r' and 's' - r,s :: Int - } - | C2 { t :: T1 -> (T2 Int Int)-> (T3 Bool Bool) -> (T4 Float Float) -> T5 () (), - u,v :: Int - } - -- ^ This is the 'C2' record constructor, also with some fields: - --- | Testing different record commenting styles -data R1 - -- | This is the 'C3' record constructor - = C3 { - -- | The 's1' record selector - s1 :: Int - -- | The 's2' record selector - , s2 :: Int - , s3 :: Int -- NOTE: In the original examples/Test.hs in Haddock, there is an extra "," here. - -- Since GHC doesn't allow that, I have removed it in this file. - -- ^ The 's3' record selector - } - --- These section headers are only used when there is no export list to --- give the structure of the documentation: - --- * This is a section header (level 1) --- ** This is a section header (level 2) --- *** This is a section header (level 3) - -{-| -In a comment string we can refer to identifiers in scope with -single quotes like this: '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) - -@ - This is a block of code, which can include other markup: 'R' - formatting - is - significant -@ - -> this is another block of code - -We can also include URLs in documentation: . --} - -f :: C a => a -> Int - --- | we can export foreign declarations too -foreign import ccall g :: Int -> IO CInt - --- | this doc string has a parse error in it: \' -h :: Int -h = 42 - - --- $aux1 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. --- --- @ code block in named doc @ - --- $aux2 This is some documentation that is attached to a name ($aux2) - --- $aux3 --- @ code block on its own in named doc @ - --- $aux4 --- --- @ code block on its own in named doc (after newline) @ - -{- $aux5 a nested, named doc comment - - with a paragraph, - - @ and a code block @ --} - --- some tests for various arrangements of code blocks: - -{- $aux6 ->test ->test1 - -@ test2 - test3 -@ --} - -{- $aux7 -@ -test1 -test2 -@ --} - -{- $aux8 ->test3 ->test4 --} - -{- $aux9 -@ -test1 -test2 -@ - ->test3 ->test4 --} - -{- $aux10 ->test3 ->test4 - -@ -test1 -test2 -@ --} - --- This one is currently wrong (Haddock 0.4). The @...@ part is --- interpreted as part of the bird-tracked code block. -{- $aux11 -aux11: - ->test3 ->test4 - -@ -test1 -test2 -@ --} - --- $aux12 --- > foo --- --- > bar --- - --- | A data-type using existential\/universal types -data Ex a - = forall b . C b => Ex1 b - | forall b . Ex2 b - | forall b . C a => Ex3 b -- NOTE: I have added "forall b" here make GHC accept this file - | Ex4 (forall a . a -> a) - --- | This is a function with documentation for each argument -k :: T () () -- ^ This argument has type 'T' - -> (T2 Int Int) -- ^ This argument has type 'T2 Int Int' - -> (T3 Bool Bool -> T4 Float Float) -- ^ This argument has type @T3 Bool Bool -> T4 Float Float@ - -> 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. - -> IO () -- ^ This is the result type - --- This function has arg docs but no docs for the function itself -l :: (Int, Int, Float) -- ^ takes a triple - -> Int -- ^ returns an 'Int' - --- | This function has some arg docs -m :: R - -> N1 () -- ^ one of the arguments - -> IO Int -- ^ and the return value - --- | This function has some arg docs but not a return value doc - --- can't use the original name ('n') with GHC -newn :: R -- ^ one of the arguments, an 'R' - -> N1 () -- ^ one of the arguments - -> IO Int -newn = undefined - - --- | A foreign import with argument docs -foreign import ccall unsafe - o :: Float -- ^ The input float - -> IO Float -- ^ The output float - --- | We should be able to escape this: \#\#\# - --- p :: Int --- can't use the above original definition with GHC -newp :: Int -newp = undefined - --- | a function with a prime can be referred to as 'f'' --- but f' doesn't get link'd 'f\'' -f' :: Int - - --- Add some definitions here so that this file can be compiled with GHC - -data T1 -f = undefined -f' = undefined -type CInt = Int -k = undefined -l = undefined -m = undefined diff --git a/tests/pre-2.0-tests/Test.html.ref b/tests/pre-2.0-tests/Test.html.ref deleted file mode 100644 index 50df8e7e..00000000 --- a/tests/pre-2.0-tests/Test.html.ref +++ /dev/null @@ -1,3105 +0,0 @@ - - -Test
 ContentsIndex
Test
Portabilityportable
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
Type declarations -
Data types -
Records -
Class declarations -
Function types -
Auxiliary stuff -
A hidden module -
A visible module -
Existential / Universal types -
Type signatures with argument docs -
A section -
A subsection -
Description
This module illustrates & tests most of the features of Haddock. - Testing references from the description: T, f, g, visible. -
Synopsis
data T a b
= A Int Maybe Float
| B (T a b, T Int Float)
data T2 a b
data T3 a b
= A1 a
| B1 b
data T4 a b
= A2 a
| B2 b
data T5 a b
= A3 a
| B3 b
data T6
= A4
| B4
| C4
newtype N1 a = N1 a
newtype N2 a b = N2 {
n :: a b
}
newtype N3 a b = N3 {
n3 :: a b
}
data N4 a b
newtype N5 a b = N5 {
n5 :: a b
}
newtype N6 a b = N6 {
n6 :: a b
}
newtype N7 a b = N7 {
n7 :: a b
}
data R
= C1 {
p :: Int
q :: forall a. a -> a
r :: Int
s :: Int
}
| C2 {
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
}
data R1 = C3 {
s1 :: Int
s2 :: Int
s3 :: Int
}
p :: R -> Int
q :: R -> forall a. a -> a
u :: R -> Int
class D a => C a where
a :: IO a
b :: [a]
class D a where
d :: T a b
e :: (a, a)
class E a
class F a where
ff :: a
a :: C a => IO a
f :: C a => a -> Int
g :: Int -> IO CInt
hidden :: Int -> Int
module Visible
data Ex a
= forall b . C b => Ex1 b
| forall b . Ex2 b
| forall b . C a => Ex3 b
| Ex4 forall a. a -> a
k :: T () () -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 () () -> IO ()
l :: (Int, Int, Float) -> Int
m :: R -> N1 () -> IO Int
o :: Float -> IO Float
f' :: Int
Type declarations -
Data types -
data T a b
This comment applies to the following declaration - and it continues until the next non-comment line -
Constructors
A Int Maybe FloatThis comment describes the A constructor -
B (T a b, T Int Float)This comment describes the B constructor -
data T2 a b
An abstract data declaration -
data T3 a b
A data declaration with no documentation annotations on the constructors -
Constructors
A1 a
B1 b
data T4 a b
Constructors
A2 a
B2 b
data T5 a b
Constructors
A3 adocuments A3 -
B3 bdocuments B3 -
data T6
Testing alternative comment styles -
Constructors
A4This is the doc for A4 -
B4This is the doc for B4 -
C4This is the doc for C4 -
newtype N1 a
A newtype -
Constructors
N1 a
newtype N2 a b
A newtype with a fieldname -
Constructors
N2
n :: a b
newtype N3 a b
A newtype with a fieldname, documentation on the field -
Constructors
N3
n3 :: a bthis is the n3 field -
data N4 a b
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
Constructors
N5
n5 :: a bno docs on the datatype or the constructor -
newtype N6 a b
Constructors
N6docs on the constructor only -
n6 :: a b
newtype N7 a b
docs on the newtype and the constructor -
Constructors
N7The N7 constructor -
n7 :: a b
Records -
data R
This is the documentation for the R record, which has four fields, - p, q, r, and s. -
Constructors
C1This is the C1 record constructor, with the following fields: -
p :: IntThis comment applies to the p field -
q :: forall a. a -> aThis comment applies to the q field -
r :: IntThis comment applies to both r and s -
s :: IntThis comment applies to both r and s -
C2This is the C2 record constructor, also with some fields: -
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
data R1
Testing different record commenting styles -
Constructors
C3This is the C3 record constructor -
s1 :: IntThe s1 record selector -
s2 :: IntThe s2 record selector -
s3 :: IntThe s3 record selector -
test that we can export record selectors on their own: -
p :: R -> Int
This comment applies to the p field -
q :: R -> forall a. a -> a
This comment applies to the q field -
u :: R -> Int
Class declarations -
class D a => C a where
This comment applies to the previous declaration (the C class) -
Methods
a :: IO a
this is a description of the a method -
b :: [a]
this is a description of the b method -
class D a where
This is a class declaration with no separate docs for the methods -
Methods
d :: T a b
e :: (a, a)
class E a
This is a class declaration with no methods (or no methods exported) -
class F a where
Methods
ff :: a
Test that we can export a class method on its own: -
a :: C a => IO a
this is a description of the a method -
Function types -
f :: C a => a -> Int

In a comment string we can refer to identifiers in scope with -single quotes like this: 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) -

-     This is a block of code, which can include other markup: R
-     formatting
-               is
-                 significant
-
 this is another block of code
-

We can also include URLs in documentation: http://www.haskell.org/. -

g :: Int -> IO CInt
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. -

 code block in named doc
This is some documentation that is attached to a name ($aux2) -
 code block on its own in named doc
 code block on its own in named doc (after newline)

a nested, named doc comment -

with a paragraph, -

 and a code block
test
-test1
-
 test2
-  test3
-
-test1
-test2
-
test3
-test4
-
-test1
-test2
-
test3
-test4
-
test3
-test4
-
-test1
-test2
-

aux11: -

test3
-test4
-
-test1
-test2
-
 foo
-
 bar
-

This is some inline documentation in the export list -

 a code block using bird-tracks
- each line must begin with > (which isn't significant unless it
- is at the beginning of the line).
-
A hidden module -
hidden :: Int -> Int
A visible module -
module Visible
nested-style doc comments -
Existential / Universal types -
data Ex a
A data-type using existential/universal types -
Constructors
forall b . C b => Ex1 b
forall b . Ex2 b
forall b . C a => Ex3 b
Ex4 forall a. a -> a
Type signatures with argument docs -
k
:: T () ()This argument has type T -
-> T2 Int IntThis argument has type 'T2 Int Int' -
-> T3 Bool Bool -> T4 Float FloatThis argument has type T3 Bool Bool -> T4 Float Float -
-> 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. -
-> IO ()This is the result type -
This is a function with documentation for each argument -
l
:: (Int, Int, Float)takes a triple -
-> Intreturns an Int -
m
:: R
-> N1 ()one of the arguments -
-> IO Intand the return value -
This function has some arg docs -
o
:: FloatThe input float -
-> IO FloatThe output float -
A foreign import with argument docs -
A section -
A subsection -
 a literal line
-

$ a non literal line $ -

f' :: Int
a function with a prime can be referred to as f' - but f' doesn't get link'd 'f\'' -
Produced by Haddock version 2.0.0.0
diff --git a/tests/pre-2.0-tests/Visible.hs b/tests/pre-2.0-tests/Visible.hs deleted file mode 100644 index cad71931..00000000 --- a/tests/pre-2.0-tests/Visible.hs +++ /dev/null @@ -1,3 +0,0 @@ -module Visible where -visible :: Int -> Int -visible a = a diff --git a/tests/pre-2.0-tests/Visible.html.ref b/tests/pre-2.0-tests/Visible.html.ref deleted file mode 100644 index 9561baee..00000000 --- a/tests/pre-2.0-tests/Visible.html.ref +++ /dev/null @@ -1,88 +0,0 @@ - - -Visible
 ContentsIndex
Visible
Documentation
visible :: Int -> Int
Produced by Haddock version 2.0.0.0
diff --git a/tests/runtests.hs b/tests/runtests.hs index 0f815294..ac6b293e 100644 --- a/tests/runtests.hs +++ b/tests/runtests.hs @@ -8,12 +8,13 @@ import Control.Monad import Text.Printf import Text.Regex + main = do args <- getArgs when (null args) $ error "You must give the path to the GHC lib dir as an argument" putStrLn "Running tests..." let libdir = head args - walkDirs libdir "." + test libdir putStrLn "All tests passed!" @@ -21,20 +22,14 @@ haddockEq file1 file2 = (stripLinks file1) == (stripLinks file2) where stripLinks f = subRegex (mkRegexWithOpts "]*>" False False) f "" - -allModules dir = do - contents <- getDirectoryContents dir - return $ filter ((==) ".hs" . takeExtension) contents - - check modules = do forM_ modules $ \mod -> do let outfile = "output" (dropExtension mod ++ ".html") - let reffile = dropExtension mod ++ ".html.ref" + let reffile = "tests" dropExtension mod ++ ".html.ref" b <- doesFileExist reffile if b then do - copyFile reffile ("output" reffile) + copyFile reffile ("output" takeFileName reffile) out <- readFile outfile ref <- readFile reffile if not $ haddockEq out ref @@ -48,20 +43,11 @@ check modules = do putStrLn $ "Pass: " ++ mod ++ " (no .ref file)" -walkDirs libdir basedir = do - contents <- getDirectoryContents basedir - dirs <- filterM doesDirectoryExist . - map (basedir ) . - filter (`notElem` [".", "..", "output"]) $ contents - mapM_ (testDir libdir) dirs - - -testDir libdir dir = do - mods <- allModules dir - let mods' = map (dir ) mods - let outdir = "output" dir - createDirectoryIfMissing True outdir - code <- system $ printf "../dist/build/haddock/haddock -B %s -w -o %s -h --optghc=-fglasgow-exts --optghc=-w %s" libdir outdir (unwords mods') +test libdir = do + contents <- getDirectoryContents "tests" + let mods = filter ((==) ".hs" . takeExtension) contents + let outdir = "output" + let mods' = map ("tests" ) mods + code <- system $ printf "haddock -B %s -w -o %s -h --optghc=-fglasgow-exts --optghc=-w %s" libdir outdir (unwords mods') unless (code == ExitSuccess) $ error "Haddock run failed! Exiting." - check mods' - walkDirs libdir dir + check mods diff --git a/tests/tests/A.hs b/tests/tests/A.hs new file mode 100644 index 00000000..4a344a24 --- /dev/null +++ b/tests/tests/A.hs @@ -0,0 +1,2 @@ +module A where +data A = A diff --git a/tests/tests/A.html.ref b/tests/tests/A.html.ref new file mode 100644 index 00000000..3a3c137b --- /dev/null +++ b/tests/tests/A.html.ref @@ -0,0 +1,116 @@ + + +A
 ContentsIndex
A
Documentation
data A
Constructors
A
Produced by Haddock version 2.1.0
diff --git a/tests/tests/B.hs b/tests/tests/B.hs new file mode 100644 index 00000000..3a31507e --- /dev/null +++ b/tests/tests/B.hs @@ -0,0 +1,2 @@ +module B ( module A ) where +import A diff --git a/tests/tests/B.html.ref b/tests/tests/B.html.ref new file mode 100644 index 00000000..a69e45ad --- /dev/null +++ b/tests/tests/B.html.ref @@ -0,0 +1,86 @@ + + +B
 ContentsIndex
B
Documentation
module A
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bug1.hs b/tests/tests/Bug1.hs new file mode 100644 index 00000000..af1ed4d3 --- /dev/null +++ b/tests/tests/Bug1.hs @@ -0,0 +1,6 @@ +module Bug1 where + +-- | We should have different anchors for constructors and types\/classes. This +-- hyperlink should point to the type constructor by default: 'T'. +data T = T + diff --git a/tests/tests/Bug1.html.ref b/tests/tests/Bug1.html.ref new file mode 100644 index 00000000..462f088b --- /dev/null +++ b/tests/tests/Bug1.html.ref @@ -0,0 +1,150 @@ + + +Bug1
 ContentsIndex
Bug1
Synopsis
data T = T
Documentation
data T
We should have different anchors for constructors and types/classes. This + hyperlink should point to the type constructor by default: T. +
Constructors
T
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bug2.hs b/tests/tests/Bug2.hs new file mode 100644 index 00000000..9121922e --- /dev/null +++ b/tests/tests/Bug2.hs @@ -0,0 +1,4 @@ +module Bug2 ( x ) where +import B +x :: A +x = A diff --git a/tests/tests/Bug2.html.ref b/tests/tests/Bug2.html.ref new file mode 100644 index 00000000..aa9d6647 --- /dev/null +++ b/tests/tests/Bug2.html.ref @@ -0,0 +1,90 @@ + + +Bug2
 ContentsIndex
Bug2
Documentation
x :: A
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bug3.hs b/tests/tests/Bug3.hs new file mode 100644 index 00000000..67e57892 --- /dev/null +++ b/tests/tests/Bug3.hs @@ -0,0 +1,6 @@ +module Bug3 where + +-- | /multi-line +-- emphasis/ +foo :: Int +foo = undefined diff --git a/tests/tests/Bug3.html.ref b/tests/tests/Bug3.html.ref new file mode 100644 index 00000000..60f4b890 --- /dev/null +++ b/tests/tests/Bug3.html.ref @@ -0,0 +1,114 @@ + + +Bug3
 ContentsIndex
Bug3
Synopsis
foo :: Int
Documentation
foo :: Int
/multi-line + emphasis/ +
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bug4.hs b/tests/tests/Bug4.hs new file mode 100644 index 00000000..425a77aa --- /dev/null +++ b/tests/tests/Bug4.hs @@ -0,0 +1,5 @@ +module Bug4 where +-- | don't use apostrophe's in the wrong place's +foo :: Int +foo = undefined + diff --git a/tests/tests/Bug4.html.ref b/tests/tests/Bug4.html.ref new file mode 100644 index 00000000..c2921742 --- /dev/null +++ b/tests/tests/Bug4.html.ref @@ -0,0 +1,113 @@ + + +Bug4
 ContentsIndex
Bug4
Synopsis
foo :: Int
Documentation
foo :: Int
don't use apostrophe's in the wrong place's +
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bug6.hs b/tests/tests/Bug6.hs new file mode 100644 index 00000000..498983df --- /dev/null +++ b/tests/tests/Bug6.hs @@ -0,0 +1,23 @@ +-- | Exporting records. +module Bug6( A(A), B(B), b, C(C,c1,c2), D(D,d1), E(E) ) where + +-- | +-- This record is exported without its field +data A = A { a :: Int } + +-- | +-- .. with its field, but the field is named separately in the export list +-- (should still be visible as a field name) +data B = B { b :: Int } + +-- | +-- .. with fields names as subordinate names in the export +data C = C { c1 :: Int, c2 :: Int } + +-- | +-- .. with only some of the fields exported (we can't handle this one - +-- how do we render the declaration?) +data D = D { d1 :: Int, d2 :: Int } + +-- | a newtype with a field +newtype E = E { e :: Int } diff --git a/tests/tests/Bug6.html.ref b/tests/tests/Bug6.html.ref new file mode 100644 index 00000000..806f5470 --- /dev/null +++ b/tests/tests/Bug6.html.ref @@ -0,0 +1,482 @@ + + +Bug6
 ContentsIndex
Bug6
Description
Exporting records. +
Synopsis
data A = A Int
data B = B {
b :: Int
}
b :: B -> Int
data C = C {
c1 :: Int
c2 :: Int
}
data D = D Int Int
newtype E = E Int
Documentation
data A
This record is exported without its field +
Constructors
A Int
data B
.. with its field, but the field is named separately in the export list + (should still be visible as a field name) +
Constructors
B
b :: Int
b :: B -> Int
data C
.. with fields names as subordinate names in the export +
Constructors
C
c1 :: Int
c2 :: Int
data D
.. with only some of the fields exported (we can't handle this one - + how do we render the declaration?) +
Constructors
D Int Int
newtype E
a newtype with a field +
Constructors
E Int
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bug7.hs b/tests/tests/Bug7.hs new file mode 100644 index 00000000..8cf57914 --- /dev/null +++ b/tests/tests/Bug7.hs @@ -0,0 +1,12 @@ +-- | This module caused a duplicate instance in the documentation for the Foo +-- type. +module Bug7 where + +-- | The Foo datatype +data Foo = Foo + +-- | The Bar class +class Bar x y + +-- | Just one instance +instance Bar Foo Foo diff --git a/tests/tests/Bug7.html.ref b/tests/tests/Bug7.html.ref new file mode 100644 index 00000000..788ae3a9 --- /dev/null +++ b/tests/tests/Bug7.html.ref @@ -0,0 +1,242 @@ + + +Bug7
 ContentsIndex
Bug7
Description
This module caused a duplicate instance in the documentation for the Foo + type. +
Synopsis
data Foo = Foo
class Bar x y
Documentation
data Foo
The Foo datatype +
Constructors
Foo
show/hide Instances
class Bar x y
The Bar class +
show/hide Instances
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bug8.hs b/tests/tests/Bug8.hs new file mode 100644 index 00000000..0f279c29 --- /dev/null +++ b/tests/tests/Bug8.hs @@ -0,0 +1,17 @@ +{- Note that declarations without type signatures are not included in the + documentation. They could be, but that's a missing feature. -} + +module Bug8 where + +infix --> +infix ---> + +data Typ = Type (String,[Typ]) + | TFree (String, [String]) + +x --> y = Type("fun",[s,t]) +(--->) = flip $ foldr (-->) + +s = undefined +t = undefined +main = undefined diff --git a/tests/tests/Bug8.html.ref b/tests/tests/Bug8.html.ref new file mode 100644 index 00000000..d6be9969 --- /dev/null +++ b/tests/tests/Bug8.html.ref @@ -0,0 +1,128 @@ + + +Bug8
 ContentsIndex
Bug8
Documentation
data Typ
Constructors
Type (String, [Typ])
TFree (String, [String])
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Bugs.hs b/tests/tests/Bugs.hs new file mode 100644 index 00000000..8e1f0079 --- /dev/null +++ b/tests/tests/Bugs.hs @@ -0,0 +1,3 @@ +module Bugs where + +data A a = A a (a -> Int) diff --git a/tests/tests/Bugs.html.ref b/tests/tests/Bugs.html.ref new file mode 100644 index 00000000..f9a3522b --- /dev/null +++ b/tests/tests/Bugs.html.ref @@ -0,0 +1,116 @@ + + +Bugs
 ContentsIndex
Bugs
Documentation
data A a
Constructors
A a (a -> Int)
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Hash.hs b/tests/tests/Hash.hs new file mode 100644 index 00000000..7d6506f9 --- /dev/null +++ b/tests/tests/Hash.hs @@ -0,0 +1,51 @@ +{- | + Implementation of fixed-size hash tables, with a type + class for constructing hash values for structured types. +-} +module Hash ( + -- * The @HashTable@ type + HashTable, + + -- ** Operations on @HashTable@s + new, insert, lookup, + + -- * The @Hash@ class + Hash(..), + ) where + +import Array +import Prelude hiding (lookup) + +-- | A hash table with keys of type @key@ and values of type @val@. +-- The type @key@ should be an instance of 'Eq'. +data HashTable key val = HashTable Int (Array Int [(key,val)]) + +-- | Builds a new hash table with a given size +new :: (Eq key, Hash key) => Int -> IO (HashTable key val) +new = undefined + +-- | Inserts a new element into the hash table +insert :: (Eq key, Hash key) => key -> val -> IO () +insert = undefined + +-- | Looks up a key in the hash table, returns @'Just' val@ if the key +-- was found, or 'Nothing' otherwise. +lookup :: Hash key => key -> IO (Maybe val) +lookup = undefined + +-- | A class of types which can be hashed. +class Hash a where + -- | hashes the value of type @a@ into an 'Int' + hash :: a -> Int + +instance Hash Int where + hash = id + +instance Hash Float where + hash = trunc + +instance (Hash a, Hash b) => Hash (a,b) where + hash (a,b) = hash a `xor` hash b + +trunc = undefined +xor = undefined diff --git a/tests/tests/Hash.html.ref b/tests/tests/Hash.html.ref new file mode 100644 index 00000000..5e03b2ef --- /dev/null +++ b/tests/tests/Hash.html.ref @@ -0,0 +1,412 @@ + + +Hash
 ContentsIndex
Hash
Contents
The HashTable type +
Operations on HashTables +
The Hash class +
Description
Implementation of fixed-size hash tables, with a type + class for constructing hash values for structured types. +
Synopsis
data HashTable key val
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
insert :: (Eq key, Hash key) => key -> val -> IO ()
lookup :: Hash key => key -> IO (Maybe val)
class Hash a where
hash :: a -> Int
The HashTable type +
data HashTable key val
A hash table with keys of type key and values of type val. + The type key should be an instance of Eq. +
Operations on HashTables +
new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
Builds a new hash table with a given size +
insert :: (Eq key, Hash key) => key -> val -> IO ()
Inserts a new element into the hash table +
lookup :: Hash key => key -> IO (Maybe val)
Looks up a key in the hash table, returns Just val if the key + was found, or Nothing otherwise. +
The Hash class +
class Hash a where
A class of types which can be hashed. +
Methods
hash :: a -> Int
hashes the value of type a into an Int +
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Hidden.hs b/tests/tests/Hidden.hs new file mode 100644 index 00000000..e46fc37f --- /dev/null +++ b/tests/tests/Hidden.hs @@ -0,0 +1,4 @@ +{-# OPTIONS_HADDOCK hide #-} +module Hidden where +hidden :: Int -> Int +hidden a = a diff --git a/tests/tests/NoLayout.hs b/tests/tests/NoLayout.hs new file mode 100644 index 00000000..ac8e58bb --- /dev/null +++ b/tests/tests/NoLayout.hs @@ -0,0 +1,12 @@ + +-- Haddock comments are parsed as separate declarations so we +-- need to insert a ';' when using them with explicit layout. +-- This should probably be changed. + +module NoLayout where { + -- | the class 'C' + ; + g :: Int; + g = undefined + } + diff --git a/tests/tests/NoLayout.html.ref b/tests/tests/NoLayout.html.ref new file mode 100644 index 00000000..4709e907 --- /dev/null +++ b/tests/tests/NoLayout.html.ref @@ -0,0 +1,113 @@ + + +NoLayout
 ContentsIndex
NoLayout
Synopsis
g :: Int
Documentation
g :: Int
the class C +
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Test.hs b/tests/tests/Test.hs new file mode 100644 index 00000000..230f32d8 --- /dev/null +++ b/tests/tests/Test.hs @@ -0,0 +1,410 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Test +-- Copyright : (c) Simon Marlow 2002 +-- License : BSD-style +-- +-- Maintainer : libraries@haskell.org +-- Stability : provisional +-- Portability : portable +-- +-- This module illustrates & tests most of the features of Haddock. +-- Testing references from the description: 'T', 'f', 'g', 'Visible.visible'. +-- +----------------------------------------------------------------------------- + +-- This is plain comment, ignored by Haddock. + +module Test ( + + -- Section headings are introduced with '-- *': + -- * Type declarations + + -- Subsection headings are introduced with '-- **' and so on. + -- ** Data types + T(..), T2, T3(..), T4(..), T5(..), T6(..), + N1(..), N2(..), N3(..), N4, N5(..), N6(..), N7(..), + + -- ** Records + R(..), R1(..), + + -- | test that we can export record selectors on their own: + p, q, u, + + -- * Class declarations + C(a,b), D(..), E, F(..), + + -- | Test that we can export a class method on its own: + a, + + -- * Function types + f, g, + + -- * Auxiliary stuff + + -- $aux1 + + -- $aux2 + + -- $aux3 + + -- $aux4 + + -- $aux5 + + -- $aux6 + + -- $aux7 + + -- $aux8 + + -- $aux9 + + -- $aux10 + + -- $aux11 + + -- $aux12 + + -- | This is some inline documentation in the export list + -- + -- > a code block using bird-tracks + -- > each line must begin with > (which isn't significant unless it + -- > is at the beginning of the line). + + -- * A hidden module + module Hidden, + + -- * A visible module + module Visible, + + {-| nested-style doc comments -} + + -- * Existential \/ Universal types + Ex(..), + + -- * Type signatures with argument docs + k, l, m, o, + + -- * A section + -- and without an intervening comma: + -- ** A subsection + +{-| + > a literal line + + $ a non /literal/ line $ +-} + + f' + ) where + +import Hidden +import Visible +import Data.Maybe + +bla = Nothing + +-- | This comment applies to the /following/ declaration +-- and it continues until the next non-comment line +data T a b + = A Int (Maybe Float) -- ^ This comment describes the 'A' constructor + | -- | This comment describes the 'B' constructor + B (T a b, T Int Float) -- ^ + +-- | An abstract data declaration +data T2 a b = T2 a b + +-- | A data declaration with no documentation annotations on the constructors +data T3 a b = A1 a | B1 b + +-- A data declaration with no documentation annotations at all +data T4 a b = A2 a | B2 b + +-- A data declaration documentation on the constructors only +data T5 a b + = A3 a -- ^ documents 'A3' + | B3 b -- ^ documents 'B3' + +-- | Testing alternative comment styles +data T6 + -- | This is the doc for 'A4' + = A4 + | B4 + | -- ^ This is the doc for 'B4' + + -- | This is the doc for 'C4' + C4 + +-- | A newtype +newtype N1 a = N1 a + +-- | A newtype with a fieldname +newtype N2 a b = N2 {n :: a b} + +-- | A newtype with a fieldname, documentation on the field +newtype N3 a b = N3 {n3 :: a b -- ^ this is the 'n3' field + } + +-- | 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 N4 a b = N4 a + +newtype N5 a b = N5 {n5 :: a b -- ^ no docs on the datatype or the constructor + } + +newtype N6 a b = N6 {n6 :: a b + } + -- ^ docs on the constructor only + +-- | docs on the newtype and the constructor +newtype N7 a b = N7 {n7 :: a b + } + -- ^ The 'N7' constructor + + +class (D a) => C a where + -- |this is a description of the 'a' method + a :: IO a + b :: [a] + -- ^ this is a description of the 'b' method + c :: a -- c is hidden in the export list + +-- ^ This comment applies to the /previous/ declaration (the 'C' class) + +class D a where + d :: T a b + e :: (a,a) +-- ^ This is a class declaration with no separate docs for the methods + +instance D Int where + d = undefined + e = undefined + +-- instance with a qualified class name +instance Test.D Float where + d = undefined + e = undefined + +class E a where + ee :: a +-- ^ This is a class declaration with no methods (or no methods exported) + +-- This is a class declaration with no documentation at all +class F a where + ff :: a + +-- | This is the documentation for the 'R' record, which has four fields, +-- 'p', 'q', 'r', and 's'. +data R = + -- | This is the 'C1' record constructor, with the following fields: + C1 { p :: Int -- ^ This comment applies to the 'p' field + , q :: forall a . a->a -- ^ This comment applies to the 'q' field + , -- | This comment applies to both 'r' and 's' + r,s :: Int + } + | C2 { t :: T1 -> (T2 Int Int)-> (T3 Bool Bool) -> (T4 Float Float) -> T5 () (), + u,v :: Int + } + -- ^ This is the 'C2' record constructor, also with some fields: + +-- | Testing different record commenting styles +data R1 + -- | This is the 'C3' record constructor + = C3 { + -- | The 's1' record selector + s1 :: Int + -- | The 's2' record selector + , s2 :: Int + , s3 :: Int -- NOTE: In the original examples/Test.hs in Haddock, there is an extra "," here. + -- Since GHC doesn't allow that, I have removed it in this file. + -- ^ The 's3' record selector + } + +-- These section headers are only used when there is no export list to +-- give the structure of the documentation: + +-- * This is a section header (level 1) +-- ** This is a section header (level 2) +-- *** This is a section header (level 3) + +{-| +In a comment string we can refer to identifiers in scope with +single quotes like this: '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) + +@ + This is a block of code, which can include other markup: 'R' + formatting + is + significant +@ + +> this is another block of code + +We can also include URLs in documentation: . +-} + +f :: C a => a -> Int + +-- | we can export foreign declarations too +foreign import ccall g :: Int -> IO CInt + +-- | this doc string has a parse error in it: \' +h :: Int +h = 42 + + +-- $aux1 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. +-- +-- @ code block in named doc @ + +-- $aux2 This is some documentation that is attached to a name ($aux2) + +-- $aux3 +-- @ code block on its own in named doc @ + +-- $aux4 +-- +-- @ code block on its own in named doc (after newline) @ + +{- $aux5 a nested, named doc comment + + with a paragraph, + + @ and a code block @ +-} + +-- some tests for various arrangements of code blocks: + +{- $aux6 +>test +>test1 + +@ test2 + test3 +@ +-} + +{- $aux7 +@ +test1 +test2 +@ +-} + +{- $aux8 +>test3 +>test4 +-} + +{- $aux9 +@ +test1 +test2 +@ + +>test3 +>test4 +-} + +{- $aux10 +>test3 +>test4 + +@ +test1 +test2 +@ +-} + +-- This one is currently wrong (Haddock 0.4). The @...@ part is +-- interpreted as part of the bird-tracked code block. +{- $aux11 +aux11: + +>test3 +>test4 + +@ +test1 +test2 +@ +-} + +-- $aux12 +-- > foo +-- +-- > bar +-- + +-- | A data-type using existential\/universal types +data Ex a + = forall b . C b => Ex1 b + | forall b . Ex2 b + | forall b . C a => Ex3 b -- NOTE: I have added "forall b" here make GHC accept this file + | Ex4 (forall a . a -> a) + +-- | This is a function with documentation for each argument +k :: T () () -- ^ This argument has type 'T' + -> (T2 Int Int) -- ^ This argument has type 'T2 Int Int' + -> (T3 Bool Bool -> T4 Float Float) -- ^ This argument has type @T3 Bool Bool -> T4 Float Float@ + -> 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. + -> IO () -- ^ This is the result type + +-- This function has arg docs but no docs for the function itself +l :: (Int, Int, Float) -- ^ takes a triple + -> Int -- ^ returns an 'Int' + +-- | This function has some arg docs +m :: R + -> N1 () -- ^ one of the arguments + -> IO Int -- ^ and the return value + +-- | This function has some arg docs but not a return value doc + +-- can't use the original name ('n') with GHC +newn :: R -- ^ one of the arguments, an 'R' + -> N1 () -- ^ one of the arguments + -> IO Int +newn = undefined + + +-- | A foreign import with argument docs +foreign import ccall unsafe + o :: Float -- ^ The input float + -> IO Float -- ^ The output float + +-- | We should be able to escape this: \#\#\# + +-- p :: Int +-- can't use the above original definition with GHC +newp :: Int +newp = undefined + +-- | a function with a prime can be referred to as 'f'' +-- but f' doesn't get link'd 'f\'' +f' :: Int + + +-- Add some definitions here so that this file can be compiled with GHC + +data T1 +f = undefined +f' = undefined +type CInt = Int +k = undefined +l = undefined +m = undefined diff --git a/tests/tests/Test.html.ref b/tests/tests/Test.html.ref new file mode 100644 index 00000000..38df4004 --- /dev/null +++ b/tests/tests/Test.html.ref @@ -0,0 +1,3105 @@ + + +Test
 ContentsIndex
Test
Portabilityportable
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
Type declarations +
Data types +
Records +
Class declarations +
Function types +
Auxiliary stuff +
A hidden module +
A visible module +
Existential / Universal types +
Type signatures with argument docs +
A section +
A subsection +
Description
This module illustrates & tests most of the features of Haddock. + Testing references from the description: T, f, g, visible. +
Synopsis
data T a b
= A Int (Maybe Float)
| B (T a b, T Int Float)
data T2 a b
data T3 a b
= A1 a
| B1 b
data T4 a b
= A2 a
| B2 b
data T5 a b
= A3 a
| B3 b
data T6
= A4
| B4
| C4
newtype N1 a = N1 a
newtype N2 a b = N2 {
n :: a b
}
newtype N3 a b = N3 {
n3 :: a b
}
data N4 a b
newtype N5 a b = N5 {
n5 :: a b
}
newtype N6 a b = N6 {
n6 :: a b
}
newtype N7 a b = N7 {
n7 :: a b
}
data R
= C1 {
p :: Int
q :: forall a. a -> a
r :: Int
s :: Int
}
| C2 {
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
}
data R1 = C3 {
s1 :: Int
s2 :: Int
s3 :: Int
}
p :: R -> Int
q :: R -> forall a. a -> a
u :: R -> Int
class D a => C a where
a :: IO a
b :: [a]
class D a where
d :: T a b
e :: (a, a)
class E a
class F a where
ff :: a
a :: C a => IO a
f :: C a => a -> Int
g :: Int -> IO CInt
hidden :: Int -> Int
module Visible
data Ex a
= forall b . C b => Ex1 b
| forall b . Ex2 b
| forall b . C a => Ex3 b
| Ex4 (forall a. a -> a)
k :: T () () -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 () () -> IO ()
l :: (Int, Int, Float) -> Int
m :: R -> N1 () -> IO Int
o :: Float -> IO Float
f' :: Int
Type declarations +
Data types +
data T a b
This comment applies to the following declaration + and it continues until the next non-comment line +
Constructors
A Int (Maybe Float)This comment describes the A constructor +
B (T a b, T Int Float)This comment describes the B constructor +
data T2 a b
An abstract data declaration +
data T3 a b
A data declaration with no documentation annotations on the constructors +
Constructors
A1 a
B1 b
data T4 a b
Constructors
A2 a
B2 b
data T5 a b
Constructors
A3 adocuments A3 +
B3 bdocuments B3 +
data T6
Testing alternative comment styles +
Constructors
A4This is the doc for A4 +
B4This is the doc for B4 +
C4This is the doc for C4 +
newtype N1 a
A newtype +
Constructors
N1 a
newtype N2 a b
A newtype with a fieldname +
Constructors
N2
n :: a b
newtype N3 a b
A newtype with a fieldname, documentation on the field +
Constructors
N3
n3 :: a bthis is the n3 field +
data N4 a b
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
Constructors
N5
n5 :: a bno docs on the datatype or the constructor +
newtype N6 a b
Constructors
N6docs on the constructor only +
n6 :: a b
newtype N7 a b
docs on the newtype and the constructor +
Constructors
N7The N7 constructor +
n7 :: a b
Records +
data R
This is the documentation for the R record, which has four fields, + p, q, r, and s. +
Constructors
C1This is the C1 record constructor, with the following fields: +
p :: IntThis comment applies to the p field +
q :: forall a. a -> aThis comment applies to the q field +
r :: IntThis comment applies to both r and s +
s :: IntThis comment applies to both r and s +
C2This is the C2 record constructor, also with some fields: +
t :: T1 -> (T2 Int Int) -> (T3 Bool Bool) -> (T4 Float Float) -> T5 () ()
u :: Int
v :: Int
data R1
Testing different record commenting styles +
Constructors
C3This is the C3 record constructor +
s1 :: IntThe s1 record selector +
s2 :: IntThe s2 record selector +
s3 :: IntThe s3 record selector +
test that we can export record selectors on their own: +
p :: R -> Int
This comment applies to the p field +
q :: R -> forall a. a -> a
This comment applies to the q field +
u :: R -> Int
Class declarations +
class D a => C a where
This comment applies to the previous declaration (the C class) +
Methods
a :: IO a
this is a description of the a method +
b :: [a]
this is a description of the b method +
class D a where
This is a class declaration with no separate docs for the methods +
Methods
d :: T a b
e :: (a, a)
class E a
This is a class declaration with no methods (or no methods exported) +
class F a where
Methods
ff :: a
Test that we can export a class method on its own: +
a :: C a => IO a
this is a description of the a method +
Function types +
f :: C a => a -> Int

In a comment string we can refer to identifiers in scope with +single quotes like this: 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) +

+     This is a block of code, which can include other markup: R
+     formatting
+               is
+                 significant
+
 this is another block of code
+

We can also include URLs in documentation: http://www.haskell.org/. +

g :: Int -> IO CInt
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. +

 code block in named doc
This is some documentation that is attached to a name ($aux2) +
 code block on its own in named doc
 code block on its own in named doc (after newline)

a nested, named doc comment +

with a paragraph, +

 and a code block
test
+test1
+
 test2
+  test3
+
+test1
+test2
+
test3
+test4
+
+test1
+test2
+
test3
+test4
+
test3
+test4
+
+test1
+test2
+

aux11: +

test3
+test4
+
+test1
+test2
+
 foo
+
 bar
+

This is some inline documentation in the export list +

 a code block using bird-tracks
+ each line must begin with > (which isn't significant unless it
+ is at the beginning of the line).
+
A hidden module +
hidden :: Int -> Int
A visible module +
module Visible
nested-style doc comments +
Existential / Universal types +
data Ex a
A data-type using existential/universal types +
Constructors
forall b . C b => Ex1 b
forall b . Ex2 b
forall b . C a => Ex3 b
Ex4 (forall a. a -> a)
Type signatures with argument docs +
k
:: T () ()This argument has type T +
-> T2 Int IntThis argument has type 'T2 Int Int' +
-> T3 Bool Bool -> T4 Float FloatThis argument has type T3 Bool Bool -> T4 Float Float +
-> 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. +
-> IO ()This is the result type +
This is a function with documentation for each argument +
l
:: (Int, Int, Float)takes a triple +
-> Intreturns an Int +
m
:: R
-> N1 ()one of the arguments +
-> IO Intand the return value +
This function has some arg docs +
o
:: FloatThe input float +
-> IO FloatThe output float +
A foreign import with argument docs +
A section +
A subsection +
 a literal line
+

$ a non literal line $ +

f' :: Int
a function with a prime can be referred to as f' + but f' doesn't get link'd 'f\'' +
Produced by Haddock version 2.1.0
diff --git a/tests/tests/TypeOperators.hs b/tests/tests/TypeOperators.hs new file mode 100644 index 00000000..aa0fbe8c --- /dev/null +++ b/tests/tests/TypeOperators.hs @@ -0,0 +1,22 @@ +module TypeOperators ( + -- * stuff + (:-:), + (:+:), + Op, + O(..), + biO, + Flip(..) +) where + +data a :-: b + +data (a :+: b) c + +data a `Op` b + +newtype (g `O` f) a = O { unO :: g (f a) } + +biO :: (g `O` f) a +biO = undefined + +newtype Flip (~>) b a = Flip { unFlip :: a ~> b } diff --git a/tests/tests/TypeOperators.html.ref b/tests/tests/TypeOperators.html.ref new file mode 100644 index 00000000..9c0149dd --- /dev/null +++ b/tests/tests/TypeOperators.html.ref @@ -0,0 +1,380 @@ + + +TypeOperators
 ContentsIndex
TypeOperators
Contents
stuff +
Synopsis
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a = O {
unO :: g (f a)
}
biO :: (g `O` f) a
newtype Flip (~>) b a = Flip {
unFlip :: a ~> b
}
stuff +
data a :-: b
data (a :+: b) c
data Op a b
newtype O g f a
Constructors
O
unO :: g (f a)
biO :: (g `O` f) a
newtype Flip (~>) b a
Constructors
Flip
unFlip :: a ~> b
Produced by Haddock version 2.1.0
diff --git a/tests/tests/Visible.hs b/tests/tests/Visible.hs new file mode 100644 index 00000000..cad71931 --- /dev/null +++ b/tests/tests/Visible.hs @@ -0,0 +1,3 @@ +module Visible where +visible :: Int -> Int +visible a = a diff --git a/tests/tests/Visible.html.ref b/tests/tests/Visible.html.ref new file mode 100644 index 00000000..9ed7f264 --- /dev/null +++ b/tests/tests/Visible.html.ref @@ -0,0 +1,88 @@ + + +Visible
 ContentsIndex
Visible
Documentation
visible :: Int -> Int
Produced by Haddock version 2.1.0
-- cgit v1.2.3