summaryrefslogtreecommitdiff
path: root/testsuite/tests/rebindable/RebindableFailA.hs
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2018-11-10 01:12:52 +0100
committerBen Gamari <ben@smart-cactus.org>2019-03-22 10:34:51 -0400
commitab51bee40c82cd552bcf13e24b67d43f3b8d25f3 (patch)
treea75a4102576dad50af44e342fb9152e7270792eb /testsuite/tests/rebindable/RebindableFailA.hs
parentcd07086ada34888c08585f4dc98a961618748ed0 (diff)
downloadhaskell-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/rebindable/RebindableFailA.hs')
-rw-r--r--testsuite/tests/rebindable/RebindableFailA.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/rebindable/RebindableFailA.hs b/testsuite/tests/rebindable/RebindableFailA.hs
new file mode 100644
index 0000000000..0fc6444190
--- /dev/null
+++ b/testsuite/tests/rebindable/RebindableFailA.hs
@@ -0,0 +1,19 @@
+-- Test that RebindableSyntax and the new MonadFail interact correctly.
+--
+-- This should fail with the message "Failed with error".
+
+{-# LANGUAGE RebindableSyntax #-}
+
+import Prelude hiding (fail)
+
+fail :: String -> a
+fail _ = error "Failed with error"
+
+f :: Maybe Int -> Maybe ()
+f x = do
+ 42 <- x
+ return ()
+{-# NOINLINE f #-}
+
+main = print (f (Just 55))
+