summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T3346.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T3346.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/T3346.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T3346.hs b/testsuite/tests/typecheck/should_compile/T3346.hs
new file mode 100644
index 0000000000..bba57a06f9
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T3346.hs
@@ -0,0 +1,19 @@
+{-# OPTIONS_GHC -XTypeFamilies #-}
+
+-- Trac #3346
+
+module Foo where
+
+class EP a where
+ type Result a
+ from :: a -> Result a
+ to :: Result a -> a
+
+{-# RULES "rule1" forall x. to (from x) = x #-}
+{-# RULES "rule2" forall x. from (to x) = x #-}
+
+foo :: EP a => a -> a
+-- This is typed in a way rather similarly to RULE rule1
+foo x = to (from x)
+
+bar x = from (to x)