blob: c4d738db09f213a9776fa80f575b0427605b9e89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
module T10176(buggy) where
{-# NOINLINE error2Args #-}
error2Args :: () -> () -> a
error2Args _ _ = error "here"
newtype ReaderT r a = ReaderT { runReaderT :: r -> IO a }
instance Functor (ReaderT r) where
fmap = undefined
instance Applicative (ReaderT r) where
pure = liftReaderT . pure
f <*> v = undefined
m *> k = ReaderT $ \r -> do runReaderT m r; runReaderT k r
instance Monad (ReaderT r) where
m >>= k = undefined
liftReaderT :: IO a -> ReaderT r a
liftReaderT m = ReaderT (const m)
{-# NOINLINE buggy #-}
buggy fun unit bool =
runReaderT (do
if bool then liftReaderT $ print () else pure ()
case fun unit of
True -> do
error2Args unit unit
pure ()
_ -> pure ()
) () :: IO ()
|