summaryrefslogtreecommitdiff
path: root/testsuite/tests/ado/T12490.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/ado/T12490.hs')
-rw-r--r--testsuite/tests/ado/T12490.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/ado/T12490.hs b/testsuite/tests/ado/T12490.hs
new file mode 100644
index 0000000000..e1bb022990
--- /dev/null
+++ b/testsuite/tests/ado/T12490.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE RebindableSyntax #-}
+{-# LANGUAGE ApplicativeDo #-}
+
+module T12490 where
+
+import Prelude (Int, String, Functor(..), ($), undefined, (+))
+
+join :: Monad f => f (f a) -> f a
+join = undefined
+
+class Functor f => Applicative f where
+ pure :: a -> f a
+ (<*>) :: f (a -> b) -> f a -> f b
+
+class Applicative f => Monad f where
+ return :: a -> f a
+ (>>=) :: f a -> (a -> f b) -> f b
+ fail :: String -> f a
+
+f_app :: Applicative f => f Int -> f Int -> f Int
+f_app a b = do
+ a' <- a
+ b' <- b
+ pure (a' + b')
+
+f_monad :: Monad f => f Int -> f Int -> f Int
+f_monad a b = do
+ a' <- a
+ b' <- b
+ return $ a' + b'