summaryrefslogtreecommitdiff
path: root/testsuite/tests/rebindable/RebindableFailB.hs
blob: 6c25864685b18bd6e1fb558a9d8d2292ccff7385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- Test that RebindableSyntax and the new MonadFail interact correctly.
--
-- This should print "Just ()"

{-# 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 42))