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/monadfail/MonadFailWarnings.hs | |
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/monadfail/MonadFailWarnings.hs')
-rw-r--r-- | testsuite/tests/monadfail/MonadFailWarnings.hs | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/testsuite/tests/monadfail/MonadFailWarnings.hs b/testsuite/tests/monadfail/MonadFailWarnings.hs deleted file mode 100644 index 7e3d7fc428..0000000000 --- a/testsuite/tests/monadfail/MonadFailWarnings.hs +++ /dev/null @@ -1,107 +0,0 @@ --- Test purpose: --- Ensure that MonadFail warnings are issued correctly if the warning flag --- is enabled -{-# LANGUAGE NoMonadFailDesugaring #-} -{-# OPTIONS_GHC -Wmissing-monadfail-instances -Wno-error=compat #-} - -module MonadFailWarnings where - -import Control.Monad.Fail -import Control.Monad.ST -import Data.Functor.Identity - - - --- should warn, because the do-block gets a general Monad constraint, --- but should have MonadFail -general :: Monad m => m a -general = do - Just x <- undefined - undefined - - - --- should NOT warn, because the constraint is correct -general' :: MonadFail m => m a -general' = do - Just x <- undefined - undefined - - - --- should warn, because Identity isn't MonadFail -identity :: Identity a -identity = do - Just x <- undefined - undefined - - - --- should NOT warn, because IO is MonadFail -io :: IO a -io = do - Just x <- undefined - undefined - - - --- should warn, because (ST s) is not MonadFail -st :: ST s a -st = do - Just x <- undefined - undefined - - - --- should warn, because (r ->) is not MonadFail -reader :: r -> a -reader = do - Just x <- undefined - undefined - - - --- should NOT warn, because matching against newtype -newtype Newtype a = Newtype a -newtypeMatch :: Identity a -newtypeMatch = do - Newtype x <- undefined - undefined - - - --- should NOT warn, because Data has only one constructor -data Data a = Data a -singleConMatch :: Identity a -singleConMatch = do - Data x <- undefined - undefined - - - --- should NOT warn, because Maybe' has a MonadFail instance -data Maybe' a = Nothing' | Just' a -instance Functor Maybe' where fmap = undefined -instance Applicative Maybe' where pure = undefined; (<*>) = undefined -instance Monad Maybe' where (>>=) = undefined -instance MonadFail Maybe' where fail = undefined -customFailable :: Maybe' a -customFailable = do - Just x <- undefined - undefined - - --- should NOT warn, because patterns always match -wildcardx, explicitlyIrrefutable, wildcard_, tuple :: Monad m => m a -wildcardx = do - x <- undefined - undefined -explicitlyIrrefutable = do - ~(x:y) <- undefined - undefined -wildcard_ = do - _ <- undefined - undefined -tuple = do - (a,b) <- undefined - undefined |