Test Trac #10634
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 13 Jul 2015 12:28:27 +0000 (13:28 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 13 Jul 2015 12:28:27 +0000 (13:28 +0100)
testsuite/tests/indexed-types/should_compile/T10634.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_compile/all.T

diff --git a/testsuite/tests/indexed-types/should_compile/T10634.hs b/testsuite/tests/indexed-types/should_compile/T10634.hs
new file mode 100644 (file)
index 0000000..f02cf81
--- /dev/null
@@ -0,0 +1,23 @@
+{-# LANGUAGE TypeFamilies #-}
+module T10634 where
+
+import Data.Int (Int8, Int16, Int32)
+
+type family Up a
+type instance Up Int8  = Int16
+type instance Up Int16 = Int32
+
+class (Up (Down a) ~ a) => Convert a where
+   type Down a
+   down :: a -> Down a
+
+instance Convert Int16 where
+   type Down Int16 = Int8
+   down = fromIntegral
+
+instance Convert Int32 where
+   type Down Int32 = Int16
+   down = fromIntegral
+
+x :: Int8
+x = down 8
index 67be121..3bc73a3 100644 (file)
@@ -260,4 +260,4 @@ test('T10139', normal, compile, [''])
 test('T10340', normal, compile, [''])
 test('T10226', normal, compile, [''])
 test('T10507', normal, compile, [''])
-
+test('T10634', normal, compile, [''])