summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2013-11-19 11:48:59 +0000
committerJoachim Breitner <mail@joachim-breitner.de>2013-11-19 11:48:59 +0000
commit483ff505b7e1616680b8e8605292ae160a6ff77d (patch)
tree5a8e830c6776c1ccd3da52071114cf852f689201
parent79034762edf684f33cf5e7b478f48726060be6f6 (diff)
downloadhaskell-483ff505b7e1616680b8e8605292ae160a6ff77d.tar.gz
Add examples from #8541 to testsuite
-rw-r--r--testsuite/tests/typecheck/should_run/TcCoercible.hs10
-rw-r--r--testsuite/tests/typecheck/should_run/TcCoercible.stdout4
2 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_run/TcCoercible.hs b/testsuite/tests/typecheck/should_run/TcCoercible.hs
index bb1ea40609..f5a3b9732b 100644
--- a/testsuite/tests/typecheck/should_run/TcCoercible.hs
+++ b/testsuite/tests/typecheck/should_run/TcCoercible.hs
@@ -11,6 +11,10 @@ newtype Baz = Baz Bar deriving Show
type role Map nominal representational
data Map a b = Map a b deriving Show
+-- Higher kinded coercions (#8541)
+newtype List a = List [a] deriving Show
+data T f = T (f Int)
+
main = do
print (coerce $ one :: Age)
print (coerce $ Age 1 :: Int)
@@ -25,7 +29,13 @@ main = do
print (coerce $ Just one :: First Int)
print (coerce $ (mempty :: Last Age) :: Last Int)
+ printT (coerce $ (T (Left (Age 1)) :: T (Either Age)) :: T (Either Int))
+ printT (coerce $ (T (Left one) :: T (Either Int)) :: T (Either Age))
+ printT (coerce $ (T [one] :: T []) :: T List)
+ printT (coerce $ (T (List [one]) :: T List) :: T [])
+
where one = 1 :: Int
+ printT (T x) = print x
diff --git a/testsuite/tests/typecheck/should_run/TcCoercible.stdout b/testsuite/tests/typecheck/should_run/TcCoercible.stdout
index 6eb10ade03..5c92bf4c0d 100644
--- a/testsuite/tests/typecheck/should_run/TcCoercible.stdout
+++ b/testsuite/tests/typecheck/should_run/TcCoercible.stdout
@@ -7,3 +7,7 @@ Foo (Age 1)
Map 1 (Age 1)
First {getFirst = Just 1}
Last {getLast = Nothing}
+Left 1
+Left (Age 1)
+List [1]
+[1]