blob: 514737307afb5954d853c8c8ea9a6940d9976451 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
{-# LANGUAGE DataKinds #-}
module T17366_ARa where
import Control.Monad.IO.Class
import Data.Kind
type Effect = (Type -> Type) -> Type -> Type
data Env (es :: [Effect]) = Env
newtype Eff (es :: [Effect]) a = Eff { unEff :: Env es -> IO a }
deriving Functor
instance Applicative (Eff es) where
pure a = Eff $ \_ -> pure a
f <*> a = Eff $ \es -> unEff f es <*> unEff a es
instance Monad (Eff es) where
m >>= f = Eff $ \es -> unEff m es >>= (`unEff` es) . f
instance MonadIO (Eff es) where
liftIO m = Eff $ \_ -> m
----------------------------------------
smallTest :: MonadIO m => m ()
smallTest = do
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
{-# INLINABLE smallTest #-} -- When uncommented, smallTestSpec no longer uses specialized smallTest.
test :: MonadIO m => m ()
test = do
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
liftIO $ putStrLn "test"
{-# INLINABLE test #-}
|