[commit: testsuite] wip/T8541: Add examples from #8541 to testsuite (bbfaff2)

git at git.haskell.org git at git.haskell.org
Tue Nov 19 11:48:46 UTC 2013


Repository : ssh://git@git.haskell.org/testsuite

On branch  : wip/T8541
Link       : http://ghc.haskell.org/trac/ghc/changeset/bbfaff2fa89b21bee058af7e6e6ddd66524524d0/testsuite

>---------------------------------------------------------------

commit bbfaff2fa89b21bee058af7e6e6ddd66524524d0
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Tue Nov 19 11:48:59 2013 +0000

    Add examples from #8541 to testsuite


>---------------------------------------------------------------

bbfaff2fa89b21bee058af7e6e6ddd66524524d0
 tests/typecheck/should_run/TcCoercible.hs     |   10 ++++++++++
 tests/typecheck/should_run/TcCoercible.stdout |    4 ++++
 2 files changed, 14 insertions(+)

diff --git a/tests/typecheck/should_run/TcCoercible.hs b/tests/typecheck/should_run/TcCoercible.hs
index bb1ea40..f5a3b97 100644
--- a/tests/typecheck/should_run/TcCoercible.hs
+++ b/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/tests/typecheck/should_run/TcCoercible.stdout b/tests/typecheck/should_run/TcCoercible.stdout
index 6eb10ad..5c92bf4 100644
--- a/tests/typecheck/should_run/TcCoercible.stdout
+++ b/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]



More information about the ghc-commits mailing list