diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2018-11-10 01:12:52 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-03-22 10:34:51 -0400 |
commit | ab51bee40c82cd552bcf13e24b67d43f3b8d25f3 (patch) | |
tree | a75a4102576dad50af44e342fb9152e7270792eb /testsuite/tests/warnings | |
parent | cd07086ada34888c08585f4dc98a961618748ed0 (diff) | |
download | haskell-ab51bee40c82cd552bcf13e24b67d43f3b8d25f3.tar.gz |
base: Remove `Monad(fail)` method and reexport `MonadFail(fail)` instead
As per https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail
Coauthored-by: Ben Gamari <ben@well-typed.com>
Diffstat (limited to 'testsuite/tests/warnings')
-rw-r--r-- | testsuite/tests/warnings/should_compile/T11128.hs | 50 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/T11128.stderr | 20 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/T11128b.hs | 64 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/T11128b.stderr | 10 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/all.T | 2 |
5 files changed, 0 insertions, 146 deletions
diff --git a/testsuite/tests/warnings/should_compile/T11128.hs b/testsuite/tests/warnings/should_compile/T11128.hs deleted file mode 100644 index 23725c1e4b..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128.hs +++ /dev/null @@ -1,50 +0,0 @@ -{-# LANGUAGE DeriveFunctor #-} -{-# OPTIONS_GHC -fwarn-noncanonical-monad-instances #-} - --- | Test noncanonical-monad-instances warnings -module T11128 where - -import Control.Applicative as A -import Control.Monad as M - ----------------------------------------------------------------------------- --- minimal definition - -data T0 a = T0 a deriving Functor - -instance A.Applicative T0 where - pure = T0 - (<*>) = M.ap - -instance M.Monad T0 where - (>>=) = undefined - ----------------------------------------------------------------------------- --- trigger all 4 warnings - -data T1 a = T1 a deriving Functor - -instance A.Applicative T1 where - pure = return - (<*>) = M.ap - (*>) = (M.>>) - -instance M.Monad T1 where - (>>=) = undefined - return = T1 - (>>) = undefined - ----------------------------------------------------------------------------- --- backward compat canonical definition - -data T2 a = T2 a deriving Functor - -instance Applicative T2 where - pure = T2 - (<*>) = ap - (*>) = undefined - -instance M.Monad T2 where - (>>=) = undefined - return = pure - (>>) = (*>) diff --git a/testsuite/tests/warnings/should_compile/T11128.stderr b/testsuite/tests/warnings/should_compile/T11128.stderr deleted file mode 100644 index b8d788236c..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128.stderr +++ /dev/null @@ -1,20 +0,0 @@ - -T11128.hs:28:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘pure = return’ definition detected - in the instance declaration for ‘Applicative T1’. - Move definition from ‘return’ to ‘pure’ - -T11128.hs:30:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘(*>) = (>>)’ definition detected - in the instance declaration for ‘Applicative T1’. - Move definition from ‘(>>)’ to ‘(*>)’ - -T11128.hs:34:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘return’ definition detected - in the instance declaration for ‘Monad T1’. - Either remove definition for ‘return’ or define as ‘return = pure’ - -T11128.hs:35:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘(>>)’ definition detected - in the instance declaration for ‘Monad T1’. - Either remove definition for ‘(>>)’ or define as ‘(>>) = (*>)’ diff --git a/testsuite/tests/warnings/should_compile/T11128b.hs b/testsuite/tests/warnings/should_compile/T11128b.hs deleted file mode 100644 index 497927716c..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128b.hs +++ /dev/null @@ -1,64 +0,0 @@ -{-# LANGUAGE DeriveFunctor #-} -{-# OPTIONS_GHC -Wnoncanonical-monadfail-instances #-} - --- | Test noncanonical-monadfail-instances warnings -module T11128b where - -import Control.Applicative as A -import Control.Monad as M -import Control.Monad.Fail as MF - ----------------------------------------------------------------------------- --- minimal definition - -data T0 a = T0 a deriving Functor - -instance A.Applicative T0 where - pure = T0 - (<*>) = M.ap - -instance M.Monad T0 where - (>>=) = undefined - -instance MF.MonadFail T0 where - fail = error "fail" - ----------------------------------------------------------------------------- --- trigger all 2 warnings - -data T1 a = T1 a deriving Functor - -instance A.Applicative T1 where - pure = return - (<*>) = M.ap - (*>) = (M.>>) - -instance M.Monad T1 where - (>>=) = undefined - return = T1 - (>>) = undefined - fail = error "fail" - -instance MF.MonadFail T1 where - fail = M.fail - ----------------------------------------------------------------------------- --- backward compat canonical definition - -data T2 a = T2 a deriving Functor - -instance Applicative T2 where - pure = T2 - (<*>) = ap - (*>) = undefined - -instance M.Monad T2 where - (>>=) = undefined - return = pure - (>>) = (*>) - fail = MF.fail - -instance MF.MonadFail T2 where - fail = error "fail" - ----------------------------------------------------------------------------- diff --git a/testsuite/tests/warnings/should_compile/T11128b.stderr b/testsuite/tests/warnings/should_compile/T11128b.stderr deleted file mode 100644 index e3fd3e83dc..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128b.stderr +++ /dev/null @@ -1,10 +0,0 @@ - -T11128b.hs:40:5: warning: [-Wnoncanonical-monadfail-instances] - Noncanonical ‘fail’ definition detected - in the instance declaration for ‘Monad T1’. - Either remove definition for ‘fail’ or define as ‘fail = Control.Monad.Fail.fail’ - -T11128b.hs:43:5: warning: [-Wnoncanonical-monadfail-instances] - Noncanonical ‘fail = Control.Monad.fail’ definition detected - in the instance declaration for ‘MonadFail T1’. - Move definition from ‘Control.Monad.fail’ to ‘fail’ diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T index 10a3ecf12c..36e6b1beeb 100644 --- a/testsuite/tests/warnings/should_compile/all.T +++ b/testsuite/tests/warnings/should_compile/all.T @@ -9,8 +9,6 @@ test('T10908', normal, compile, ['']) test('T10930', normal, compile, ['']) test('T10930b', normal, compile, ['']) test('T11077', normal, compile, ['-fwarn-missing-exported-signatures']) -test('T11128', normal, compile, ['']) -test('T11128b', normal, compile, ['']) test('T13256', normal, compile, ['']) test('T15460', normal, compile, ['']) test('PluralS', normal, compile, ['']) |