From f3e76a50eec28d17ddd0fe8e965c15c19c4ef3cf Mon Sep 17 00:00:00 2001 From: Alec Theriault Date: Fri, 20 Jul 2018 04:50:00 -0700 Subject: Misc tests (#858) * More tests * spliced types * constructor/pattern argument docs * strictness marks on fields with argument docs * latex test cases need seperate directory * Accept tests --- html-test/ref/Bug574.html | 86 ++++ html-test/ref/ConstructorArgs.html | 720 +++++++++++++++++++++++++++++++++ html-test/ref/GadtConstructorArgs.html | 192 +++++++++ html-test/src/Bug745.hs | 8 + html-test/src/ConstructorArgs.hs | 56 +++ html-test/src/GadtConstructorArgs.hs | 13 + 6 files changed, 1075 insertions(+) create mode 100644 html-test/ref/Bug574.html create mode 100644 html-test/ref/ConstructorArgs.html create mode 100644 html-test/ref/GadtConstructorArgs.html create mode 100644 html-test/src/Bug745.hs create mode 100644 html-test/src/ConstructorArgs.hs create mode 100644 html-test/src/GadtConstructorArgs.hs (limited to 'html-test') diff --git a/html-test/ref/Bug574.html b/html-test/ref/Bug574.html new file mode 100644 index 00000000..ed0a5e15 --- /dev/null +++ b/html-test/ref/Bug574.html @@ -0,0 +1,86 @@ +Bug574

Safe HaskellNone

Bug574

Synopsis

Documentation

foo :: Int -> Int -> Int #

Somthing with a spliced type

\ No newline at end of file diff --git a/html-test/ref/ConstructorArgs.html b/html-test/ref/ConstructorArgs.html new file mode 100644 index 00000000..9aad9c86 --- /dev/null +++ b/html-test/ref/ConstructorArgs.html @@ -0,0 +1,720 @@ +ConstructorArgs

Safe HaskellSafe

ConstructorArgs

Synopsis

Documentation

data Foo infixr 1 #

Constructors

Rec

doc on a record

Fields

Baz Int String

old prefix doc style

Boa infixr 2

doc on the Boa constrictor

Fields

Int :| String

old infix doc style

(:*) infixr 3

doc on the :* constructor

Fields

data Boo where infixr 4 #

Constructors

Foo infixr 1

Info about a Foo

Fields

Foa :: Int -> Boo

no argument docs GADT

Bundled Patterns

pattern Fo infixr 5

Info about bundled Fo

Fields

pattern Fo' :: Boo

Bundled and no argument docs

pattern Bo infixr 6 #

Arguments

:: Int

an Int

-> String

a String

-> Boo

a Boo pattern

Info about not-bundled Bo

pattern Bo' :: Int -> String -> Boo #

Not bunded and no argument docs

\ No newline at end of file diff --git a/html-test/ref/GadtConstructorArgs.html b/html-test/ref/GadtConstructorArgs.html new file mode 100644 index 00000000..7497de83 --- /dev/null +++ b/html-test/ref/GadtConstructorArgs.html @@ -0,0 +1,192 @@ +GadtConstructorArgs

Safe HaskellSafe

GadtConstructorArgs

Documentation

data Boo where #

Constructors

Fot

Fields

Fob

Record GADT with docs

Fields

\ No newline at end of file diff --git a/html-test/src/Bug745.hs b/html-test/src/Bug745.hs new file mode 100644 index 00000000..f26562c1 --- /dev/null +++ b/html-test/src/Bug745.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell, QuasiQuotes #-} + +module Bug574 where +-- See https://github.com/haskell/haddock/issues/574 + +-- | Somthing with a spliced type +foo :: Int -> $(let i = [t| Int |] in [t| $i -> $i |]) +foo x y = x + y diff --git a/html-test/src/ConstructorArgs.hs b/html-test/src/ConstructorArgs.hs new file mode 100644 index 00000000..6b0da711 --- /dev/null +++ b/html-test/src/ConstructorArgs.hs @@ -0,0 +1,56 @@ +{-# LANGUAGE GADTs, PatternSynonyms #-} + +module ConstructorArgs (Foo(..), Boo(Foo, Foa, Fo, Fo'), pattern Bo, pattern Bo') where + +data Foo + = Rec -- ^ doc on a record + { x :: String -- ^ doc on the `String` field of `Rec` + , y :: String -- ^ doc on the `String` field of `Rec` + } + | Baz Int String -- ^ old prefix doc style + | Boa -- ^ doc on the `Boa` constrictor + !Int -- ^ doc on the `Int` field of `Boa` + !String -- ^ doc on the `String` field of `Boa` + | Int :| String -- ^ old infix doc style + | Int -- ^ doc on the `Int` field of the `:*` constructor + :* -- ^ doc on the `:*` constructor + String -- ^ doc on the `String` field of the `:*` constructor + +infixr 1 `Foo` +infixr 2 `Boa` +infixr 3 :* + +data Boo where + -- | Info about a 'Foo' + Foo :: Int -- ^ `Int` field of `Foo` + -> String -- ^ `String` field of `Foo` + -> Boo -- ^ Make a `Boo` + + -- | no argument docs GADT + Foa :: Int -> Boo + +infixr 4 `Boo` + +-- | Info about bundled 'Fo' +pattern Fo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' +pattern Fo x y = Foo x y + +-- | Bundled and no argument docs +pattern Fo' :: Boo +pattern Fo' = Foo 1 "hi" + +infixr 5 `Fo` + +-- | Info about not-bundled 'Bo' +pattern Bo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' pattern +pattern Bo x y = Foo x y + +-- | Not bunded and no argument docs +pattern Bo' :: Int -> String -> Boo +pattern Bo' x y = Foo x y + +infixr 6 `Bo` diff --git a/html-test/src/GadtConstructorArgs.hs b/html-test/src/GadtConstructorArgs.hs new file mode 100644 index 00000000..79ffb4d3 --- /dev/null +++ b/html-test/src/GadtConstructorArgs.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE GADTs, PatternSynonyms #-} + +module GadtConstructorArgs (Boo(..)) where + +data Boo where + Fot :: { x :: Int -- ^ an 'x' + , y :: Int -- ^ a 'y' + } -> Boo + + -- | Record GADT with docs + Fob :: { w :: Int -- ^ a 'w' + , z :: Int -- ^ a 'z' + } -> Boo -- ^ a 'Boo' -- cgit v1.2.3