diff options
author | Yuchen Pei <hi@ypei.me> | 2022-09-14 17:58:06 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-09-15 12:46:12 +1000 |
commit | 2f8a13bb69d951365b2b81a0455d819b4dfa8388 (patch) | |
tree | 8a80e57f10ee07f75e4284ffb7e6a4daff92d378 /org-test/src | |
parent | e8157ce5e664932641e26a9b87a8d4d3c4754ca3 (diff) |
updating tests relevant to previous changesghc-gitlab-ghc-9.2.2
Diffstat (limited to 'org-test/src')
-rw-r--r-- | org-test/src/ConstructorArgs.hs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/org-test/src/ConstructorArgs.hs b/org-test/src/ConstructorArgs.hs new file mode 100644 index 00000000..40697d13 --- /dev/null +++ b/org-test/src/ConstructorArgs.hs @@ -0,0 +1,57 @@ +{-# LANGUAGE Haskell2010 #-} +{-# 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 bundled and no argument docs +pattern Bo' :: Int -> String -> Boo +pattern Bo' x y = Foo x y + +infixr 6 `Bo` |