diff options
Diffstat (limited to 'testsuite/tests/indexed-types/should_compile/Rules1.hs')
-rw-r--r-- | testsuite/tests/indexed-types/should_compile/Rules1.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/Rules1.hs b/testsuite/tests/indexed-types/should_compile/Rules1.hs new file mode 100644 index 0000000000..497c5bbeb9 --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/Rules1.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE TypeFamilies #-} + +module Rules1 where + +class C a where + data T a + +instance (C a, C b) => C (a,b) where + data T (a,b) = TPair (T a) (T b) + +mapT :: (C a, C b) => (a -> b) -> T a -> T b +mapT = undefined + +zipT :: (C a, C b) => T a -> T b -> T (a,b) +zipT = undefined + +{-# RULES + +"zipT/mapT" forall f x y. + zipT (mapT f x) y = mapT (\(x,y) -> (f x, y)) (zipT x y) + + #-} + |