summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack/should_compile
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/backpack/should_compile')
-rw-r--r--testsuite/tests/backpack/should_compile/all.T1
-rw-r--r--testsuite/tests/backpack/should_compile/bkp09.bkp2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp15.bkp2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp61.bkp36
-rw-r--r--testsuite/tests/backpack/should_compile/bkp61.stderr15
5 files changed, 54 insertions, 2 deletions
diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T
index 07c1ed27ec..9a2edebd8e 100644
--- a/testsuite/tests/backpack/should_compile/all.T
+++ b/testsuite/tests/backpack/should_compile/all.T
@@ -52,6 +52,7 @@ test('bkp57', normal, backpack_compile, [''])
test('bkp58', normal, backpack_compile, [''])
test('bkp59', normal, backpack_compile, [''])
test('bkp60', normal, backpack_compile, [''])
+test('bkp61', normal, backpack_compile, [''])
test('T13140', normal, backpack_compile, [''])
test('T13149', expect_broken(13149), backpack_compile, [''])
diff --git a/testsuite/tests/backpack/should_compile/bkp09.bkp b/testsuite/tests/backpack/should_compile/bkp09.bkp
index 64cf447715..68b9677d56 100644
--- a/testsuite/tests/backpack/should_compile/bkp09.bkp
+++ b/testsuite/tests/backpack/should_compile/bkp09.bkp
@@ -7,7 +7,7 @@ unit p where
data T a = MkT (S a)
data S a = MkS a
--- keept his synced up!
+-- keep this synced up!
unit q where
signature H where
data T a = MkT (S a)
diff --git a/testsuite/tests/backpack/should_compile/bkp15.bkp b/testsuite/tests/backpack/should_compile/bkp15.bkp
index c661eafe6f..48058417a9 100644
--- a/testsuite/tests/backpack/should_compile/bkp15.bkp
+++ b/testsuite/tests/backpack/should_compile/bkp15.bkp
@@ -22,7 +22,7 @@ unit p where
-- type instance Elem Int = Bool
-- pattern Blub n = ("foo", n)
--- keept his synced up!
+-- keep this synced up!
unit q where
signature H where
x :: (forall a. a -> a) -> (Int, Bool)
diff --git a/testsuite/tests/backpack/should_compile/bkp61.bkp b/testsuite/tests/backpack/should_compile/bkp61.bkp
new file mode 100644
index 0000000000..3ad7d721bb
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp61.bkp
@@ -0,0 +1,36 @@
+-- Check that we can implement abstract data using a data family.
+
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+
+unit p where
+ signature H where
+ import Data.Kind
+ type T :: Bool -> Type
+ data T b
+ turnOff :: T True -> T False
+ turnOn :: T False -> T True
+ module A where
+ import H
+ foo :: T True -> T True
+ foo = turnOn . turnOff
+
+unit q where
+ module H where
+ import Data.Kind
+ type D :: Bool -> Type
+ data family D a
+ data instance D True = DT
+ data instance D False = DF
+ turnOff DT = DF
+ turnOn DF = DT
+
+ type S = D
+ type T = S
+
+unit r where
+ dependency q
+ dependency p[H=q:H]
+ module N where
+ import A
+ bar = foo . foo
diff --git a/testsuite/tests/backpack/should_compile/bkp61.stderr b/testsuite/tests/backpack/should_compile/bkp61.stderr
new file mode 100644
index 0000000000..808295964d
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp61.stderr
@@ -0,0 +1,15 @@
+[1 of 3] Processing p
+ [1 of 2] Compiling H[sig] ( p\H.hsig, nothing )
+ [2 of 2] Compiling A ( p\A.hs, nothing )
+[2 of 3] Processing q
+ Instantiating q
+ [1 of 1] Compiling H ( q\H.hs, bkp61.out\q\H.o )
+[3 of 3] Processing r
+ Instantiating r
+ [1 of 2] Including q
+ [2 of 2] Including p[H=q:H]
+ Instantiating p[H=q:H]
+ [1 of 2] Compiling H[sig] ( p\H.hsig, bkp61.out\p\p-D5Mg3foBSCrDbQDKH4WGSG\H.o )
+ [2 of 2] Compiling A ( p\A.hs, bkp61.out\p\p-D5Mg3foBSCrDbQDKH4WGSG\A.o )
+ [1 of 2] Compiling N ( r\N.hs, bkp61.out\r\N.o )
+ [2 of 2] Instantiating p