Test Trac #5719
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 23 Dec 2011 16:07:05 +0000 (16:07 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 23 Dec 2011 16:07:05 +0000 (16:07 +0000)
testsuite/tests/indexed-types/should_run/T5719.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_run/T5719.stdout [new file with mode: 0644]
testsuite/tests/indexed-types/should_run/all.T

diff --git a/testsuite/tests/indexed-types/should_run/T5719.hs b/testsuite/tests/indexed-types/should_run/T5719.hs
new file mode 100644 (file)
index 0000000..91ec01a
--- /dev/null
@@ -0,0 +1,28 @@
+{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleInstances #-}
+module Main where
+
+import GHC.Prim (Constraint)
+
+import Prelude hiding (Functor, fmap)
+
+import           Data.Set (Set)
+import qualified Data.Set as S (map, fromList)
+
+class Functor f where
+    type C f a :: Constraint
+    type C f a = ()
+
+    fmap :: (C f a, C f b) => (a -> b) -> f a -> f b
+
+instance Functor Set where
+    type C Set a = Ord a
+    fmap = S.map
+
+instance Functor [] where
+    fmap = map
+--    type C [] a = ()
+
+testList = fmap (+1) [1,2,3]
+testSet  = fmap (+1) (S.fromList [1,2,3])
+
+main = do { print testList; print testSet }
diff --git a/testsuite/tests/indexed-types/should_run/T5719.stdout b/testsuite/tests/indexed-types/should_run/T5719.stdout
new file mode 100644 (file)
index 0000000..a7cf4e8
--- /dev/null
@@ -0,0 +1,2 @@
+[2,3,4]
+fromList [2,3,4]
index 454e702..c8f1f17 100644 (file)
@@ -6,3 +6,4 @@ test('T4235', normal, compile_and_run, [''])
 
 test('GMapAssoc', normal, compile_and_run, ['-package containers'])
 test('GMapTop',   normal, compile_and_run, ['-package containers'])
+test('T5719', normal, compile_and_run, [''])