diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-08-31 16:03:33 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-08-31 16:34:53 -0400 |
commit | 043604c7232adb698d5008a46d3f29d532acd12d (patch) | |
tree | 450796a5b10d64d2e04f55151955104438080e99 /testsuite/tests/ado | |
parent | e9b0bf4ed52114852dbaf6af556514610a895f88 (diff) | |
download | haskell-043604c7232adb698d5008a46d3f29d532acd12d.tar.gz |
RnExpr: Fix ApplicativeDo desugaring with RebindableSyntax
We need to compare against the local return and pure, not returnMName
and pureAName.
Fixes #12490.
Test Plan: Validate, add testcase
Reviewers: austin, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2499
GHC Trac Issues: #12490
Diffstat (limited to 'testsuite/tests/ado')
-rw-r--r-- | testsuite/tests/ado/T12490.hs | 30 | ||||
-rw-r--r-- | testsuite/tests/ado/all.T | 1 |
2 files changed, 31 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' diff --git a/testsuite/tests/ado/all.T b/testsuite/tests/ado/all.T index 06cdbf993d..67697b93e4 100644 --- a/testsuite/tests/ado/all.T +++ b/testsuite/tests/ado/all.T @@ -7,3 +7,4 @@ test('ado006', normal, compile, ['']) test('ado007', normal, compile, ['']) test('T11607', normal, compile_and_run, ['']) test('ado-optimal', normal, compile_and_run, ['']) +test('T12490', normal, compile, ['']) |