summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/ghci/should_run/UnliftedDataType2.hs28
-rw-r--r--testsuite/tests/ghci/should_run/UnliftedDataType2.stdout1
-rw-r--r--testsuite/tests/ghci/should_run/all.T1
3 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/should_run/UnliftedDataType2.hs b/testsuite/tests/ghci/should_run/UnliftedDataType2.hs
new file mode 100644
index 0000000000..2ae5471b44
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/UnliftedDataType2.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE StandaloneKindSignatures, UnliftedDatatypes #-}
+
+import GHC.Exts
+
+type Tree :: forall l. TYPE (BoxedRep l)
+data Tree where
+ Leaf :: !Word -> Tree @l
+ Bin :: Tree @Unlifted -> Tree @Unlifted -> Tree @l
+
+type Set = Tree @Lifted
+
+mseq :: Tree @Lifted -> Tree @Unlifted
+mseq (Leaf w) = Leaf w
+mseq (Bin l r) = Bin l r
+
+member :: Word -> Set -> Bool
+member w t = wmember w (mseq t)
+
+wmember :: Word -> Tree @Unlifted -> Bool
+wmember w (Leaf w2) = w == w2
+wmember w (Bin l r) = wmember w l || wmember w r
+
+set :: Set
+set = Bin (Leaf 1) (Leaf 42)
+
+main :: IO ()
+main = print $ member 42 set
+
diff --git a/testsuite/tests/ghci/should_run/UnliftedDataType2.stdout b/testsuite/tests/ghci/should_run/UnliftedDataType2.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/UnliftedDataType2.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T
index 96a12b47a5..5433a613db 100644
--- a/testsuite/tests/ghci/should_run/all.T
+++ b/testsuite/tests/ghci/should_run/all.T
@@ -83,3 +83,4 @@ test('T19733', just_ghci, compile_and_run, [''])
test('T19628', [extra_files(['T19628a.hs']), only_ways(['ghci']) ], compile_and_run, [''])
test('T21052', just_ghci, ghci_script, ['T21052.script'])
test('T21300', just_ghci, ghci_script, ['T21300.script'])
+test('UnliftedDataType2', just_ghci, compile_and_run, [''])