summaryrefslogtreecommitdiff
path: root/testsuite/tests/rebindable/RebindableFailA.hs
blob: 0fc6444190c1d22bff7f977d81170e5ff576a8ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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))