@@ -48,7 +48,7 @@ getSequenceMaybeBelow = do
4848 liftIO $ putStrLn "MaybeT below streamly: Enter one char per line: "
4949
5050 i <- S.fromFoldable [1..2 :: Int]
51− liftIO $ putStrLn $ "iteration = " ++ show i
51+ liftIO $ putStrLn $ "iteration = " <> show i
5252
5353 r1 <- liftIO getLine
5454 when (r1 /= "x") $ lift mzero
@@ -78,13 +78,13 @@ getSequenceMaybeAbove = do
7878 liftIO $ putStrLn "MaybeT above streamly: Enter one char per line: "
7979
8080 i <- lift $ S.fromFoldable [1..2 :: Int]
81− liftIO $ putStrLn $ "iteration = " ++ show i
81+ liftIO $ putStrLn $ "iteration = " <> show i
8282
8383 r1 <- liftIO getLine
84− when (r1 /= "x") $ mzero
84+ when (r1 /= "x") mzero
8585
8686 r2 <- liftIO getLine
87− when (r2 /= "y") $ mzero
87+ when (r2 /= "y") mzero
8888
8989mainMaybeAbove :: (IsStream t, MonadIO (t m)) => MaybeT (t m) ()
9090mainMaybeAbove = do
@@ -111,13 +111,13 @@ getSequenceEitherBelow = do
111111 liftIO $ putStrLn "ExceptT below streamly: Enter one char per line: "
112112
113113 i <- S.fromFoldable [1..2 :: Int]
114− liftIO $ putStrLn $ "iteration = " ++ show i
114+ liftIO $ putStrLn $ "iteration = " <> show i
115115
116116 r1 <- liftIO getLine
117− when (r1 /= "x") $ lift $ throwE $ "Expecting x got: " ++ r1
117+ when (r1 /= "x") $ lift $ throwE $ "Expecting x got: " <> r1
118118
119119 r2 <- liftIO getLine
120− when (r2 /= "y") $ lift $ throwE $ "Expecting y got: " ++ r2
120+ when (r2 /= "y") $ lift $ throwE $ "Expecting y got: " <> r2
121121
122122mainEitherBelow :: IO ()
123123mainEitherBelow = do
@@ -140,7 +140,7 @@ getSequenceEitherAsyncBelow
140140 , MonadAsync m
141141 , MonadIO (t m)
142142 , MonadIO (t (ExceptT String m))
143− , Semigroup (t (ExceptT [Char] m) Integer)
143+ , Semigroup (t (ExceptT String m) Integer)
144144 )
145145 => t (ExceptT String m) ()
146146getSequenceEitherAsyncBelow = do
@@ -151,11 +151,11 @@ getSequenceEitherAsyncBelow = do
151151 >> return 1)
152152 <> (lift (throwE "Second task") >> return 2)
153153 <> S.yield (3 :: Integer)
154− liftIO $ putStrLn $ "iteration = " ++ show i
154+ liftIO $ putStrLn $ "iteration = " <> show i
155155
156156mainEitherAsyncBelow :: IO ()
157157mainEitherAsyncBelow = do
158− r <- runExceptT (runStream $ asyncly $ getSequenceEitherAsyncBelow)
158+ r <- runExceptT (runStream $ asyncly getSequenceEitherAsyncBelow)
159159 case r of
160160 Right _ -> liftIO $ putStrLn "Bingo"
161161 Left s -> liftIO $ putStrLn s
@@ -178,25 +178,25 @@ getSequenceEitherAbove = do
178178 liftIO $ putStrLn "ExceptT above streamly: Enter one char per line: "
179179
180180 i <- lift $ S.fromFoldable [1..2 :: Int]
181− liftIO $ putStrLn $ "iteration = " ++ show i
181+ liftIO $ putStrLn $ "iteration = " <> show i
182182
183183 r1 <- liftIO getLine
184− when (r1 /= "x") $ throwE $ "Expecting x got: " ++ r1
184+ when (r1 /= "x") $ throwE $ "Expecting x got: " <> r1
185185
186186 r2 <- liftIO getLine
187− when (r2 /= "y") $ throwE $ "Expecting y got: " ++ r2
187+ when (r2 /= "y") $ throwE $ "Expecting y got: " <> r2
188188
189189mainEitherAbove :: (IsStream t, Monad m, MonadIO (t m))
190190 => ExceptT String (t m) ()
191−mainEitherAbove = do
191+mainEitherAbove =
192192 catchE (getSequenceEitherAbove >> liftIO (putStrLn "Bingo"))
193− (\e -> liftIO $ putStrLn e)
193+ (liftIO . putStrLn)
194194
195195-------------------------------------------------------------------------------
196196-- Using MonadThrow to throw exceptions in streamly
197197-------------------------------------------------------------------------------
198198--
199−data Unexpected = Unexpected String deriving Show
199+newtype Unexpected = Unexpected String deriving Show
200200
201201instance Exception Unexpected
202202
@@ -209,18 +209,18 @@ getSequenceMonadThrow = do
209209 liftIO $ putStrLn "MonadThrow in streamly: Enter one char per line: "
210210
211211 i <- S.fromFoldable [1..2 :: Int]
212− liftIO $ putStrLn $ "iteration = " ++ show i
212+ liftIO $ putStrLn $ "iteration = " <> show i
213213
214214 r1 <- liftIO getLine
215− when (r1 /= "x") $ throwM $ Unexpected $ "Expecting x got: " ++ r1
215+ when (r1 /= "x") $ throwM $ Unexpected $ "Expecting x got: " <> r1
216216
217217 r2 <- liftIO getLine
218− when (r2 /= "y") $ throwM $ Unexpected $ "Expecting y got: " ++ r2
218+ when (r2 /= "y") $ throwM $ Unexpected $ "Expecting y got: " <> r2
219219
220220mainMonadThrow :: IO ()
221−mainMonadThrow = do
221+mainMonadThrow =
222222 catch (runStream getSequenceMonadThrow >> liftIO (putStrLn "Bingo"))
223− (\(e :: SomeException) -> liftIO $ putStrLn $ show e)
223+ (\(e :: SomeException) -> liftIO $ print e)
224224
225225-------------------------------------------------------------------------------
226226-- Using ContT below streamly
@@ -238,19 +238,19 @@ getSequenceContBelow = do
238238 liftIO $ putStrLn "ContT below streamly: Enter one char per line: "
239239
240240 i <- S.fromFoldable [1..2 :: Int]
241− liftIO $ putStrLn $ "iteration = " ++ show i
241+ liftIO $ putStrLn $ "iteration = " <> show i
242242
243243 r <- lift $ callCC $ \exit -> do
244244 r1 <- liftIO getLine
245245 _ <- if r1 /= "x"
246− then exit $ Left $ "Expecting x got: " ++ r1
246+ then exit $ Left $ "Expecting x got: " <> r1
247247 else return $ Right ()
248248
249249 r2 <- liftIO getLine
250250 if r2 /= "y"
251− then exit $ Left $ "Expecting y got: " ++ r2
251+ then exit $ Left $ "Expecting y got: " <> r2
252252 else return $ Right ()
253− liftIO $ putStrLn $ "done iteration = " ++ show i
253+ liftIO $ putStrLn $ "done iteration = " <> show i
254254 return r
255255
256256mainContBelow
@@ -272,17 +272,17 @@ getSequenceContAbove = do
272272 liftIO $ putStrLn "ContT above streamly: Enter one char per line: "
273273
274274 i <- lift $ S.fromFoldable [1..2 :: Int]
275− liftIO $ putStrLn $ "iteration = " ++ show i
275+ liftIO $ putStrLn $ "iteration = " <> show i
276276
277277 callCC $ \exit -> do
278278 r1 <- liftIO getLine
279279 _ <- if r1 /= "x"
280− then exit $ Left $ "Expecting x got: " ++ r1
280+ then exit $ Left $ "Expecting x got: " <> r1
281281 else return $ Right ()
282282
283283 r2 <- liftIO getLine
284284 if r2 /= "y"
285− then exit $ Left $ "Expecting y got: " ++ r2
285+ then exit $ Left $ "Expecting y got: " <> r2
286286 else return $ Right ()
287287
288288mainContAbove :: (IsStream t, Monad m, MonadIO (t m)) => ContT r (t m) ()