on master help sign in
fix redundant constraints
commitd56382883e7f61e27829bb223b9476fb64ee69ab authorHarendra Kumar <harendra.kumar@gmail.com> dateFri 23 Aug 2019, 12:55 (7 years ago) parent5247baa
1 file changed+5−10
examples/ControlFlow.hs+5−10
examples/ControlFlow.hs+5−10
@@ -39,7 +39,6 @@ getSequenceMaybeBelow
3939 :: ( IsStream t
4040 , Monad m
4141 , MonadTrans t
42− , Applicative (t (MaybeT m))
4342 , MonadIO (t (MaybeT m))
4443 )
4544 => t (MaybeT m) ()
@@ -102,7 +101,6 @@ getSequenceEitherBelow
102101 :: ( IsStream t
103102 , MonadTrans t
104103 , Monad m
105− , MonadIO (t m)
106104 , MonadIO (t (ExceptT String m))
107105 )
108106 => t (ExceptT String m) ()
@@ -136,8 +134,6 @@ getSequenceEitherAsyncBelow
136134 :: ( IsStream t
137135 , MonadTrans t
138136 , MonadIO m
139− , MonadAsync m
140− , MonadIO (t m)
141137 , MonadIO (t (ExceptT String m))
142138 , Semigroup (t (ExceptT String m) Integer)
143139 )
@@ -171,7 +167,7 @@ mainEitherAsyncBelow = do
171167--
172168-- Here we can use catchE directly but will have to use monad-control to lift
173169-- stream operations with stream arguments.
174−getSequenceEitherAbove :: (IsStream t, Monad m, MonadIO (t m))
170+getSequenceEitherAbove :: (IsStream t, MonadIO (t m))
175171 => ExceptT String (t m) ()
176172getSequenceEitherAbove = do
177173 liftIO $ putStrLn "ExceptT above streamly: Enter one char per line: "
@@ -185,8 +181,7 @@ getSequenceEitherAbove = do
185181 r2 <- liftIO getLine
186182 when (r2 /= "y") $ throwE $ "Expecting y got: " <> r2
187183
188−mainEitherAbove :: (IsStream t, Monad m, MonadIO (t m))
189− => ExceptT String (t m) ()
184+mainEitherAbove :: (IsStream t, MonadIO (t m)) => ExceptT String (t m) ()
190185mainEitherAbove =
191186 catchE (getSequenceEitherAbove >> liftIO (putStrLn "Bingo"))
192187 (liftIO . putStrLn)
@@ -202,7 +197,7 @@ instance Exception Unexpected
202197-- Note that unlike when ExceptT is used on top, MonadThrow terminates all
203198-- iterations of non-determinism rather then just the current iteration.
204199--
205−getSequenceMonadThrow :: (IsStream t, Monad m, MonadIO (t m), MonadThrow (t m))
200+getSequenceMonadThrow :: (IsStream t, MonadIO (t m), MonadThrow (t m))
206201 => t m ()
207202getSequenceMonadThrow = do
208203 liftIO $ putStrLn "MonadThrow in streamly: Enter one char per line: "
@@ -265,7 +260,7 @@ mainContBelow = do
265260-- Using ContT above streamly
266261-------------------------------------------------------------------------------
267262--
268−getSequenceContAbove :: (IsStream t, Monad m, MonadIO (t m))
263+getSequenceContAbove :: (IsStream t, MonadIO (t m))
269264 => ContT r (t m) (Either String ())
270265getSequenceContAbove = do
271266 liftIO $ putStrLn "ContT above streamly: Enter one char per line: "
@@ -284,7 +279,7 @@ getSequenceContAbove = do
284279 then exit $ Left $ "Expecting y got: " <> r2
285280 else return $ Right ()
286281
287−mainContAbove :: (IsStream t, Monad m, MonadIO (t m)) => ContT r (t m) ()
282+mainContAbove :: (IsStream t, MonadIO (t m)) => ContT r (t m) ()
288283mainContAbove = do
289284 r <- getSequenceContAbove
290285 case r of