summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/T5002.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/indexed-types/should_compile/T5002.hs')
-rw-r--r--testsuite/tests/indexed-types/should_compile/T5002.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/T5002.hs b/testsuite/tests/indexed-types/should_compile/T5002.hs
new file mode 100644
index 0000000000..cfc82d559e
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_compile/T5002.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE TypeFamilies, FlexibleInstances, UndecidableInstances, FlexibleContexts #-}
+
+class A a
+class B a where b :: a -> ()
+instance A a => B a where b = undefined
+
+newtype Y a = Y (a -> ())
+
+okIn701 :: B a => Y a
+okIn701 = wrap $ const () . b
+
+okIn702 :: B a => Y a
+okIn702 = wrap $ b
+
+okInBoth :: B a => Y a
+okInBoth = Y $ const () . b
+
+class Wrapper a where
+ type Wrapped a
+ wrap :: Wrapped a -> a
+instance Wrapper (Y a) where
+ type Wrapped (Y a) = a -> ()
+ wrap = Y
+
+fromTicket3018 :: Eq [a] => a -> ()
+fromTicket3018 x = let {g :: Int -> Int; g = [x]==[x] `seq` id} in ()
+
+main = undefined
+