summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2011-12-23 16:07:05 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2011-12-23 16:07:05 +0000
commit6a70b5ac69a11a9ff123fd668cbc524fad18bbf4 (patch)
tree42dc07efa3dfe4d4b01ebeb31574c1c2afe1f2f2 /testsuite
parentfd9bfbd5b23353596625d95ec9916361efb50b21 (diff)
downloadhaskell-6a70b5ac69a11a9ff123fd668cbc524fad18bbf4.tar.gz
Test Trac #5719
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/indexed-types/should_run/T5719.hs28
-rw-r--r--testsuite/tests/indexed-types/should_run/T5719.stdout2
-rw-r--r--testsuite/tests/indexed-types/should_run/all.T1
3 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_run/T5719.hs b/testsuite/tests/indexed-types/should_run/T5719.hs
new file mode 100644
index 0000000000..91ec01afbf
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_run/T5719.hs
@@ -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
index 0000000000..a7cf4e8628
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_run/T5719.stdout
@@ -0,0 +1,2 @@
+[2,3,4]
+fromList [2,3,4]
diff --git a/testsuite/tests/indexed-types/should_run/all.T b/testsuite/tests/indexed-types/should_run/all.T
index 454e702c0e..c8f1f17643 100644
--- a/testsuite/tests/indexed-types/should_run/all.T
+++ b/testsuite/tests/indexed-types/should_run/all.T
@@ -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, [''])