summaryrefslogtreecommitdiff
path: root/testsuite/tests/haddock
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2016-06-18 22:44:19 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2016-06-20 16:22:07 +0200
commita7160faafd44d64c2b20a4cc65e80136a93e1aaa (patch)
treec0fa999a4696a5a05e861b0eacfcd92358d77a48 /testsuite/tests/haddock
parent5b03dc69389dc387b922c589ab9a8b92079e6a96 (diff)
downloadhaskell-a7160faafd44d64c2b20a4cc65e80136a93e1aaa.tar.gz
Testsuite: tabs -> spaces [skip ci]
Diffstat (limited to 'testsuite/tests/haddock')
-rw-r--r--testsuite/tests/haddock/haddock_examples/Test.hs178
-rw-r--r--testsuite/tests/haddock/haddock_examples/haddock.Test.stderr4
-rw-r--r--testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs52
3 files changed, 117 insertions, 117 deletions
diff --git a/testsuite/tests/haddock/haddock_examples/Test.hs b/testsuite/tests/haddock/haddock_examples/Test.hs
index da149d0ac0..71744f7325 100644
--- a/testsuite/tests/haddock/haddock_examples/Test.hs
+++ b/testsuite/tests/haddock/haddock_examples/Test.hs
@@ -4,7 +4,7 @@
-- Module : Test
-- Copyright : (c) Simon Marlow 2002
-- License : BSD-style
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Portability : portable
@@ -16,80 +16,80 @@
-- This is plain comment, ignored by Haddock.
-module Test (
+module Test (
+
+ -- Section headings are introduced with '-- *':
+ -- * Type declarations
- -- 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(..),
- -- 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(..),
- -- ** Records
- R(..), R1(..),
+ -- | test that we can export record selectors on their own:
+ p, q, u,
- -- | test that we can export record selectors on their own:
- p, q, u,
+ -- * Class declarations
+ C(a,b), D(..), E, F(..),
- -- * Class declarations
- C(a,b), D(..), E, F(..),
-
- -- | Test that we can export a class method on its own:
- a,
+ -- | Test that we can export a class method on its own:
+ a,
- -- * Function types
- f, g,
+ -- * Function types
+ f, g,
- -- * Auxiliary stuff
+ -- * Auxiliary stuff
- -- $aux1
+ -- $aux1
- -- $aux2
+ -- $aux2
- -- $aux3
+ -- $aux3
- -- $aux4
+ -- $aux4
- -- $aux5
+ -- $aux5
- -- $aux6
+ -- $aux6
- -- $aux7
+ -- $aux7
- -- $aux8
+ -- $aux8
- -- $aux9
+ -- $aux9
- -- $aux10
+ -- $aux10
- -- $aux11
+ -- $aux11
- -- $aux12
+ -- $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).
+ -- | 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 hidden module
+ module Hidden,
- -- * A visible module
- module Visible,
+ -- * A visible module
+ module Visible,
- {-| nested-style doc comments -}
+ {-| nested-style doc comments -}
- -- * Existential \/ Universal types
- Ex(..),
+ -- * Existential \/ Universal types
+ Ex(..),
- -- * Type signatures with argument docs
- k, l, m, o,
+ -- * Type signatures with argument docs
+ k, l, m, o,
- -- * A section
- -- and without an intervening comma:
- -- ** A subsection
+ -- * A section
+ -- and without an intervening comma:
+ -- ** A subsection
{-|
> a literal line
@@ -97,7 +97,7 @@ module Test (
$ a non /literal/ line $
-}
- f',
+ f',
) where
import Hidden
@@ -108,7 +108,7 @@ import Visible
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) -- ^
+ B (T a b, T Int Float) -- ^
-- | An abstract data declaration
data T2 a b = T2 a b
@@ -141,25 +141,25 @@ newtype N1 a = N1 a
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
- }
+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 constructor only
-- | docs on the newtype and the constructor
newtype N7 a b = N7 {n7 :: a b
- }
- -- ^ The 'N7' constructor
-
+ }
+ -- ^ The 'N7' constructor
+
class (D a) => C a where
-- |this is a description of the 'a' method
@@ -194,7 +194,7 @@ class F a where
-- | This is the documentation for the 'R' record, which has four fields,
-- 'p', 'q', 'r', and 's'.
-data R =
+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
@@ -207,16 +207,16 @@ data R =
-- ^ This is the 'C2' record constructor, also with some fields:
-- | Testing different record commenting styles
-data R1
+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
+ = 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
@@ -236,7 +236,7 @@ using double quotes: "Foo". We can add emphasis /like this/.
- 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)
@
@@ -342,42 +342,42 @@ test2
-- $aux12
-- > foo
---
+--
-- > bar
---
+--
-- | A data-type using existential\/universal types
-data Ex a
+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
+ | 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'
+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
+ -> 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
+-- | This function has some arg docs
m :: R
- -> N1 () -- ^ one of the arguments
- -> IO Int -- ^ and the return value
+ -> 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
+newn :: R -- ^ one of the arguments, an 'R'
+ -> N1 () -- ^ one of the arguments
-> IO Int
-newn = undefined
+newn = undefined
-- | A foreign import with argument docs
@@ -387,12 +387,12 @@ foreign import ccall unsafe "header.h"
-- | We should be able to escape this: \#\#\#
--- p :: Int
+-- p :: Int
-- can't use the above original definition with GHC
-newp :: Int
+newp :: Int
newp = undefined
--- | a function with a prime can be referred to as 'f''
+-- | a function with a prime can be referred to as 'f''
-- but f' doesn't get link'd 'f\''
f' :: Int
@@ -402,7 +402,7 @@ f' :: Int
data T1
f = undefined
f' = undefined
-type CInt = Int
+type CInt = Int
k = undefined
l = undefined
m = undefined
diff --git a/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr b/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
index 96cafba30f..77286daf62 100644
--- a/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
+++ b/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
@@ -21,7 +21,7 @@ hidden a = a
Module : Test
Copyright : (c) Simon Marlow 2002
License : BSD-style
-
+
Maintainer : libraries@haskell.org
Stability : provisional
Portability : portable
@@ -77,7 +77,7 @@ newtype N1 a = N1 a
<document comment>
newtype N2 a b = N2 {n :: a b}
<document comment>
-newtype N3 a b = N3 {n3 :: a b this is the 'n3' field }
+newtype N3 a b = N3 {n3 :: a b this is the 'n3' field}
<document comment>
newtype N4 a b = N4 a
newtype N5 a b
diff --git a/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs b/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs
index 2f5e9ca685..0e6e871215 100644
--- a/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs
+++ b/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs
@@ -1,39 +1,39 @@
module ShouldCompile where
-postInlineUnconditionally
+postInlineUnconditionally
= case Just "Hey" of
- -- The point of examining occ_info here is that for *non-values*
- -- that occur outside a lambda, the call-site inliner won't have
- -- a chance (because it doesn't know that the thing
- -- only occurs once). The pre-inliner won't have gotten
- -- it either, if the thing occurs in more than one branch
- -- So the main target is things like
- -- let x = f y in
- -- case v of
- -- True -> case x of ...
- -- False -> case x of ...
- -- I'm not sure how important this is in practice
- Just a -- OneOcc => no work-duplication issue
- -> True -- Small enough to dup
- -- ToDo: consider discount on smallEnoughToInline if int_cxt is true
- --
- -- NB: Do NOT inline arbitrarily big things, even if one_br is True
- -- Reason: doing so risks exponential behaviour. We simplify a big
- -- expression, inline it, and simplify it again. But if the
- -- very same thing happens in the big expression, we get
- -- exponential cost!
- -- PRINCIPLE: when we've already simplified an expression once,
- -- make sure that we only inline it if it's reasonably small.
+ -- The point of examining occ_info here is that for *non-values*
+ -- that occur outside a lambda, the call-site inliner won't have
+ -- a chance (because it doesn't know that the thing
+ -- only occurs once). The pre-inliner won't have gotten
+ -- it either, if the thing occurs in more than one branch
+ -- So the main target is things like
+ -- let x = f y in
+ -- case v of
+ -- True -> case x of ...
+ -- False -> case x of ...
+ -- I'm not sure how important this is in practice
+ Just a -- OneOcc => no work-duplication issue
+ -> True -- Small enough to dup
+ -- ToDo: consider discount on smallEnoughToInline if int_cxt is true
+ --
+ -- NB: Do NOT inline arbitrarily big things, even if one_br is True
+ -- Reason: doing so risks exponential behaviour. We simplify a big
+ -- expression, inline it, and simplify it again. But if the
+ -- very same thing happens in the big expression, we get
+ -- exponential cost!
+ -- PRINCIPLE: when we've already simplified an expression once,
+ -- make sure that we only inline it if it's reasonably small.
_ -> False
-- Here's an example that we don't handle well:
--- let f = if b then Left (\x.BIG) else Right (\y.BIG)
--- in \y. ....case f of {...} ....
+-- let f = if b then Left (\x.BIG) else Right (\y.BIG)
+-- in \y. ....case f of {...} ....
-- Here f is used just once, and duplicating the case work is fine (exprIsCheap).
-- But
-- * We can't preInlineUnconditionally because that woud invalidate
--- the occ info for b.
+-- the occ info for b.
-- * We can't postInlineUnconditionally because the RHS is big, and
-- that risks exponential behaviour
-- * We can't call-site inline, because the rhs is big