f9db31e5a01404161776b793c42b3f4aa1a25cd8
[ghc.git] / testsuite / tests / monadfail / MonadFailErrors.hs
1 -- Test purpose:
2 -- Break properly if MonadFail is live
3
4 {-# LANGUAGE MonadFailDesugaring #-}
5
6 module MonadFailWarnings where
7
8 import Control.Monad.Fail
9 import Control.Monad.ST
10 import Data.Functor.Identity
11
12
13
14 general :: Monad m => m a
15 general = do
16 Just x <- undefined
17 undefined
18
19
20
21 general' :: MonadFail m => m a
22 general' = do
23 Just x <- undefined
24 undefined
25
26
27
28 identity :: Identity a
29 identity = do
30 Just x <- undefined
31 undefined
32
33
34
35 io :: IO a
36 io = do
37 Just x <- undefined
38 undefined
39
40
41
42 st :: ST s a
43 st = do
44 Just x <- undefined
45 undefined
46
47
48
49 reader :: r -> a
50 reader = do
51 Just x <- undefined
52 undefined
53
54
55
56 newtype Newtype a = Newtype a
57 newtypeMatch :: Identity a
58 newtypeMatch = do
59 Newtype x <- undefined
60 undefined
61
62
63
64 data Data a = Data a
65 singleConMatch :: Identity a
66 singleConMatch = do
67 Data x <- undefined
68 undefined
69
70
71
72 data Maybe' a = Nothing' | Just' a
73 instance Functor Maybe' where fmap = undefined
74 instance Applicative Maybe' where pure = undefined; (<*>) = undefined
75 instance Monad Maybe' where (>>=) = undefined
76 instance MonadFail Maybe' where fail = undefined
77 customFailable :: Maybe' a
78 customFailable = do
79 Just x <- undefined
80 undefined
81
82
83 wildcardx, explicitlyIrrefutable, wildcard_, tuple :: Monad m => m a
84 wildcardx = do
85 x <- undefined
86 undefined
87 explicitlyIrrefutable = do
88 ~(x:y) <- undefined
89 undefined
90 wildcard_ = do
91 _ <- undefined
92 undefined
93 tuple = do
94 (a,b) <- undefined
95 undefined