diff options
-rw-r--r-- | testsuite/tests/indexed-types/should_run/T5719.hs | 28 | ||||
-rw-r--r-- | testsuite/tests/indexed-types/should_run/T5719.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/indexed-types/should_run/all.T | 1 |
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, ['']) |