Copyright | (c) Simon Marlow 2002 |
---|---|
License | (c) Simon Marlow 2002 |
Maintainer | libraries@haskell.org |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
- data T a b
- data T2 a b
- data T3 a b
- data T4 a b
- data T5 a b
- data T6
- 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
- data R1 = C3 {}
- class D a => C a where
- class D a where
- class E a
- class F a where
- ff :: a
- f :: C a => a -> Int
- g :: Int -> IO CInt
- hidden :: Int -> Int
- module Visible
- data Ex 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
- withType :: Int
- withoutType :: t
Type declarations
Data types
data T a b
This comment applies to the following declaration and it continues until the next non-comment line
data T2 a b
An abstract data declaration
data T6
Testing alternative comment styles
newtype N3 a b
A newtype with a fieldname, documentation on the 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.
Records
data R
data R1
Testing different record commenting styles
test that we can export record selectors on their own:
Class declarations
This comment applies to the previous declaration (the C
class)
class D a where
This is a class declaration with no separate docs for the methods
class E a
This is a class declaration with no methods (or no methods exported)
Test that we can export a class method on its own:
Function types
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)
- This is an ordered list
- This is the next item (different kind of bullet)
- cat
- a small, furry, domesticated mammal
- pineapple
- a fruit grown in the tropics
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/.
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
A visible module
module Visible
nested-style doc comments
Existential / Universal types
data Ex a
A data-type using existential/universal types
Type signatures with argument docs
:: T () () | This argument has type |
-> T2 Int Int | This argument has type 'T2 Int Int' |
-> (T3 Bool Bool -> T4 Float Float) | This argument has type |
-> 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
A section
A subsection
a literal line
$ a non literal line $
withoutType :: t
Comment on a definition without type signature