diff options
author | sheaf <sam.derbyshire@gmail.com> | 2021-12-29 11:58:39 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-01-02 04:20:09 -0500 |
commit | 246d278277dc3414a440639fd35c60006dfb93f0 (patch) | |
tree | 751d8fde9ffa40cbe136a58a26d1e248513bfe3c /testsuite/tests | |
parent | 44a5507f6bbc5c87e486446d7f4486f7362748b4 (diff) | |
download | haskell-246d278277dc3414a440639fd35c60006dfb93f0.tar.gz |
User's guide: newtype decls can use GADTSyntax
The user's guide failed to explicitly mention that GADTSyntax
can be used to declare newtypes, so we add an example and a couple
of explanations.
Also explains that `-XGADTs` generalises `-XExistentialQuantification`.
Fixes #20848 and #20865.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/gadt/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/gadt/gadtSyntax002.hs | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/all.T b/testsuite/tests/gadt/all.T index 3152f3561b..ce30d570f3 100644 --- a/testsuite/tests/gadt/all.T +++ b/testsuite/tests/gadt/all.T @@ -97,6 +97,7 @@ test('T3651', normal, compile_fail, ['']) test('T3638', normal, compile, ['']) test('gadtSyntax001', normal, compile, ['']) +test('gadtSyntax002', normal, compile, ['']) test('gadtSyntaxFail001', normal, compile_fail, ['']) test('gadtSyntaxFail002', normal, compile_fail, ['']) test('gadtSyntaxFail003', normal, compile_fail, ['']) diff --git a/testsuite/tests/gadt/gadtSyntax002.hs b/testsuite/tests/gadt/gadtSyntax002.hs new file mode 100644 index 0000000000..46ccfb320c --- /dev/null +++ b/testsuite/tests/gadt/gadtSyntax002.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE GADTSyntax #-} + +module GADTSyntax002 where + +newtype Down a where + Down :: { getDown :: a } -> Down a |