From 246d278277dc3414a440639fd35c60006dfb93f0 Mon Sep 17 00:00:00 2001 From: sheaf Date: Wed, 29 Dec 2021 11:58:39 +0100 Subject: 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. --- testsuite/tests/gadt/all.T | 1 + testsuite/tests/gadt/gadtSyntax002.hs | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 testsuite/tests/gadt/gadtSyntax002.hs (limited to 'testsuite/tests') 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 -- cgit v1.2.1