on master help sign in
Fix CI
commitb8c6c3ffd6c366d7432f41ab732647b75916eda8 authorAndrzej Rybczak <andrzej@rybczak.net> dateTue 22 Jun 2021, 23:36 (5 years ago) parent0d53992
3 files changed+15−14
bench/FileSizes.hs+6−2 src/Effectful/Internal/Monad.hs+2−2 tests/Main.hs+7−10
bench/FileSizes.hs+6−2
@@ -120,10 +120,10 @@ effectful_program files = do
120120
121121effectful_calculateFileSizes :: [FilePath] -> IO (Int, [String])
122122effectful_calculateFileSizes =
123− E.runEff . E.runIOE . effectful_runFile . effectful_runLogging . effectful_program
123+ E.runIOE . effectful_runFile . effectful_runLogging . effectful_program
124124
125125effectful_calculateFileSizesDeep :: [FilePath] -> IO (Int, [String])
126−effectful_calculateFileSizesDeep = E.runEff . E.runIOE
126+effectful_calculateFileSizesDeep = E.runIOE
127127 . runR . runR . runR . runR . runR
128128 . effectful_runFile . effectful_runLogging
129129 . runR . runR . runR . runR . runR
@@ -200,6 +200,8 @@ eff_calculateFileSizesDeep = L.runIO
200200----------------------------------------
201201-- freer-simple
202202
203+#ifdef VERSION_freer_simple
204+
203205data FS_File r where
204206 FS_tryFileSize :: FilePath -> FS_File (Maybe Int)
205207
@@ -257,6 +259,8 @@ fs_calculateFileSizesDeep = FS.runM
257259 where
258260 runR = FS.runReader ()
259261
262+#endif
263+
260264----------------------------------------
261265-- mtl
262266
src/Effectful/Internal/Monad.hs+2−2
@@ -129,8 +129,8 @@ instance MonadMask (Eff es) where
129129data IOE :: Effect where
130130 IOE :: IOE m r
131131
132−runIOE :: Eff '[IOE] a -> Eff '[] a
133−runIOE = evalEffect (IdE IOE)
132+runIOE :: Eff '[IOE] a -> IO a
133+runIOE = runEff . evalEffect (IdE IOE)
134134
135135instance IOE :> es => MonadIO (Eff es) where
136136 liftIO = unsafeEff_
tests/Main.hs+7−10
@@ -26,24 +26,24 @@ main = defaultMain $ testGroup "effectful"
2626 ]
2727
2828test_runState :: Assertion
29−test_runState = runEffIO $ do
29+test_runState = runIOE $ do
3030 (end, len) <- runState (0::Int) . execState collatzStart $ collatz
3131 assertEqual_ "correct end" 1 end
3232 assertEqual_ "correct len" collatzLength len
3333
3434test_evalState :: Assertion
35−test_evalState = runEffIO $ do
35+test_evalState = runIOE $ do
3636 len <- evalState (0::Int) . evalState collatzStart $ collatz *> get @Int
3737 assertEqual_ "correct len" collatzLength len
3838
3939test_stateM :: Assertion
40−test_stateM = runEffIO $ do
40+test_stateM = runIOE $ do
4141 (a, b) <- runState "hi" . stateM $ \s -> pure (s, s ++ "!!!")
4242 assertEqual_ "correct a" "hi" a
4343 assertEqual_ "correct b" "hi!!!" b
4444
4545test_deepStack :: Assertion
46−test_deepStack = runEffIO $ do
46+test_deepStack = runIOE $ do
4747 n <- evalState () . execState (0::Int) $ do
4848 evalState () . evalState () $ do
4949 evalState () $ do
@@ -55,7 +55,7 @@ test_deepStack = runEffIO $ do
5555 assertEqual_ "n" 15 n
5656
5757test_exceptions :: Assertion
58−test_exceptions = runEffIO $ do
58+test_exceptions = runIOE $ do
5959 testTry "exceptions" E.try
6060 testCatch "exceptions" E.catch
6161 testTry "lifted-base" LE.try
@@ -90,7 +90,7 @@ test_exceptions = runEffIO $ do
9090 modify @Int (+2)
9191
9292test_concurrentState :: Assertion
93−test_concurrentState = runEffIO . runHasInt x $ do
93+test_concurrentState = runIOE . runHasInt x $ do
9494 replicateConcurrently_ 2 $ do
9595 r <- goDownward 0
9696 assertEqual_ "x = n" x r
@@ -106,7 +106,7 @@ test_concurrentState = runEffIO . runHasInt x $ do
106106 goDownward $ acc + 1
107107
108108test_localEffects :: Assertion
109−test_localEffects = runEffIO $ do
109+test_localEffects = runIOE $ do
110110 x <- runHasInt 0 $ do
111111 putInt 1
112112 execState () $ do
@@ -139,9 +139,6 @@ putInt = send . PutInt
139139data Ex = Ex deriving (Eq, Show)
140140instance E.Exception Ex
141141
142−runEffIO :: Eff '[IOE] a -> IO a
143−runEffIO = runEff . runIOE
144−
145142assertEqual_ :: (Eq a, Show a, IOE :> es) => String -> a -> a -> Eff es ()
146143assertEqual_ msg expected given = liftIO $ assertEqual msg expected given
147144