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/typecheck | |
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/typecheck')
14 files changed, 18 insertions, 40 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T12763.stderr b/testsuite/tests/typecheck/should_compile/T12763.stderr index eff7c0a28f..d5abb6c6af 100644 --- a/testsuite/tests/typecheck/should_compile/T12763.stderr +++ b/testsuite/tests/typecheck/should_compile/T12763.stderr @@ -8,5 +8,5 @@ COERCION AXIOMS CLASS INSTANCES instance C Int -- Defined at T12763.hs:9:10 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/typecheck/should_compile/T15645.stderr b/testsuite/tests/typecheck/should_compile/T15645.stderr deleted file mode 100644 index 566d6bf18e..0000000000 --- a/testsuite/tests/typecheck/should_compile/T15645.stderr +++ /dev/null @@ -1,4 +0,0 @@ -T15645.hs:8:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - The failable pattern ‘Just y’ - is used together with -XRebindableSyntax. If this is intentional, - compile with -Wno-missing-monadfail-instances. diff --git a/testsuite/tests/typecheck/should_compile/T4524.hs b/testsuite/tests/typecheck/should_compile/T4524.hs index 669c4b268a..fbdc0cd77c 100644 --- a/testsuite/tests/typecheck/should_compile/T4524.hs +++ b/testsuite/tests/typecheck/should_compile/T4524.hs @@ -174,6 +174,8 @@ instance Monad Perhaps where (Succeeded _) >> k = k Unknown >> k = k return = Succeeded + +instance MonadFail Perhaps where fail _ = Unknown instance Alternative Perhaps where diff --git a/testsuite/tests/typecheck/should_compile/T4969.hs b/testsuite/tests/typecheck/should_compile/T4969.hs index 6a087974c7..b8332bdcba 100644 --- a/testsuite/tests/typecheck/should_compile/T4969.hs +++ b/testsuite/tests/typecheck/should_compile/T4969.hs @@ -89,7 +89,6 @@ instance Applicative (TCMT m) where instance Monad (TCMT m) where return = undefined (>>=) = undefined - fail = undefined instance Monad m => MonadIO (TCMT m) where diff --git a/testsuite/tests/typecheck/should_compile/Tc239_Help.hs b/testsuite/tests/typecheck/should_compile/Tc239_Help.hs index 4f39612e4e..1718c99088 100644 --- a/testsuite/tests/typecheck/should_compile/Tc239_Help.hs +++ b/testsuite/tests/typecheck/should_compile/Tc239_Help.hs @@ -20,4 +20,3 @@ instance Monad (WrapIO e) where m >>= f = MkWrapIO (do x <- unwrap m unwrap (f x) ) - fail str = error str
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr index d3ea7d4533..227df63ecc 100644 --- a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr @@ -36,8 +36,6 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: [Integer] -> Integer) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: Integer) @@ -116,8 +114,6 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: a5 -> [Integer] -> Integer) (_ :: a5) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) (_ :: t1) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: [Integer] -> Integer) (_ :: t1) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: [Integer] -> Integer) (_ :: t1) @@ -156,8 +152,6 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: Integer -> [Integer] -> Integer) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: [Integer] -> Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: [Integer] -> Integer) @@ -240,8 +234,6 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: a5 -> Integer -> [Integer] -> Integer) (_ :: a5) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) (_ :: t1) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: Integer -> [Integer] -> Integer) (_ :: t1) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: Integer -> [Integer] -> Integer) (_ :: t1) diff --git a/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr index 3ba80087e5..233f8e23d2 100644 --- a/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr @@ -37,8 +37,6 @@ constraint_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: [a] -> a) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: a) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: a) diff --git a/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr index 888680d228..51e29fd3a2 100644 --- a/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr @@ -71,11 +71,6 @@ refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] with ($) @'GHC.Types.LiftedRep @[Integer] @Integer (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 (and originally defined in ‘GHC.Base’)) - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a - with fail @((->) [Integer]) @Integer - (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 - (and originally defined in ‘GHC.Base’)) return (_ :: Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a with return @((->) [Integer]) @Integer @@ -172,11 +167,6 @@ refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] with ($) @'GHC.Types.LiftedRep @Integer @([Integer] -> Integer) (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 (and originally defined in ‘GHC.Base’)) - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a - with fail @((->) Integer) @([Integer] -> Integer) - (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 - (and originally defined in ‘GHC.Base’)) return (_ :: [Integer] -> Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a with return @((->) Integer) @([Integer] -> Integer) diff --git a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr index 7751113761..0d15bc4d1d 100644 --- a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr @@ -9,10 +9,10 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] Valid hole fits include lines :: String -> [String] (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 - (and originally defined in ‘base-4.12.0.0:Data.OldList’)) + (and originally defined in ‘base-4.13.0.0:Data.OldList’)) words :: String -> [String] (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 - (and originally defined in ‘base-4.12.0.0:Data.OldList’)) + (and originally defined in ‘base-4.13.0.0:Data.OldList’)) read :: forall a. Read a => String -> a with read @[String] (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 @@ -25,6 +25,10 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] with mempty @([Char] -> [String]) (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 (and originally defined in ‘GHC.Base’)) + fail :: forall (m :: * -> *) a. MonadFail m => String -> m a + with fail @[] @String + (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 + (and originally defined in ‘Control.Monad.Fail’)) return :: forall (m :: * -> *) a. Monad m => a -> m a with return @[] @String (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 @@ -33,7 +37,3 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] with pure @[] @String (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 (and originally defined in ‘GHC.Base’)) - fail :: forall (m :: * -> *) a. Monad m => String -> m a - with fail @[] @String - (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 - (and originally defined in ‘GHC.Base’)) diff --git a/testsuite/tests/typecheck/should_compile/tc231.stderr b/testsuite/tests/typecheck/should_compile/tc231.stderr index 8340d3f033..ed38d5309a 100644 --- a/testsuite/tests/typecheck/should_compile/tc231.stderr +++ b/testsuite/tests/typecheck/should_compile/tc231.stderr @@ -15,5 +15,5 @@ DATA CONSTRUCTORS Z :: forall a. a -> Z a Node :: forall s a chain. s -> a -> chain -> Q s a chain Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr index c9d6f44e20..355bfe959c 100644 --- a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr @@ -244,10 +244,10 @@ valid_hole_fits.hs:41:8: warning: [-Wtyped-holes (in -Wdefault)] with print @[Char] (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘System.IO’)) - fail :: forall (m :: * -> *) a. Monad m => String -> m a + fail :: forall (m :: * -> *) a. MonadFail m => String -> m a with fail @IO @() (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 - (and originally defined in ‘GHC.Base’)) + (and originally defined in ‘Control.Monad.Fail’)) mempty :: forall a. Monoid a => a with mempty @([Char] -> IO ()) (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 diff --git a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr index c4d811c567..ef6e0def11 100644 --- a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr +++ b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr @@ -1,13 +1,13 @@ TcStaticPointersFail02.hs:9:6: error: - • No instance for (base-4.12.0.0:Data.Typeable.Internal.Typeable b) + • No instance for (base-4.13.0.0:Data.Typeable.Internal.Typeable b) arising from a static form • In the expression: static (undefined :: (forall a. a -> a) -> b) In an equation for ‘f1’: f1 = static (undefined :: (forall a. a -> a) -> b) TcStaticPointersFail02.hs:12:6: error: - • No instance for (base-4.12.0.0:Data.Typeable.Internal.Typeable + • No instance for (base-4.13.0.0:Data.Typeable.Internal.Typeable (Monad m => a -> m a)) arising from a static form (maybe you haven't applied a function to enough arguments?) diff --git a/testsuite/tests/typecheck/should_fail/tcfail182.stderr b/testsuite/tests/typecheck/should_fail/tcfail182.stderr index 35e2e2d2c9..e57c3c1672 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail182.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail182.stderr @@ -4,7 +4,7 @@ tcfail182.hs:9:3: error: with actual type ‘Maybe a0’ NB: ‘Maybe’ is defined at tcfail182.hs:6:1-18 ‘Prelude.Maybe’ - is defined in ‘GHC.Maybe’ in package ‘base-4.12.0.0’ + is defined in ‘GHC.Maybe’ in package ‘base-4.13.0.0’ • In the pattern: Foo In an equation for ‘f’: f Foo = 3 • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_run/T1735_Help/State.hs b/testsuite/tests/typecheck/should_run/T1735_Help/State.hs index 44078ae944..093a7e2c81 100644 --- a/testsuite/tests/typecheck/should_run/T1735_Help/State.hs +++ b/testsuite/tests/typecheck/should_run/T1735_Help/State.hs @@ -11,7 +11,9 @@ instance Monad m => Monad (StateT s m) where m >>= k = StateT $ \s -> do ~(a, s') <- runStateT m s runStateT (k a) s' - fail str = StateT $ \_ -> fail str + +instance MonadFail m => MonadFail (StateT s m) where + fail s = StateT $ \_ -> fail s instance Monad m => Functor (StateT s m) where fmap = liftM |