diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-07-20 04:50:00 -0700 |
---|---|---|
committer | Alexander Biehl <alexbiehl@gmail.com> | 2018-07-20 13:50:00 +0200 |
commit | f3e76a50eec28d17ddd0fe8e965c15c19c4ef3cf (patch) | |
tree | 8e32e6e12b45ce35be502e3b67fbb061175a18b2 /latex-test/src | |
parent | 8ac6ac1097f2ec2bc9a7f9bdd765abf71164bfcb (diff) |
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
Diffstat (limited to 'latex-test/src')
-rw-r--r-- | latex-test/src/ConstructorArgs/ConstructorArgs.hs | 56 | ||||
-rw-r--r-- | latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs | 13 |
2 files changed, 69 insertions, 0 deletions
diff --git a/latex-test/src/ConstructorArgs/ConstructorArgs.hs b/latex-test/src/ConstructorArgs/ConstructorArgs.hs new file mode 100644 index 00000000..6b0da711 --- /dev/null +++ b/latex-test/src/ConstructorArgs/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/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs b/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs new file mode 100644 index 00000000..79ffb4d3 --- /dev/null +++ b/latex-test/src/GadtConstructorArgs/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' |