Restrict type of monadic binding
From HaskellWiki
(Difference between revisions)
(types of other monadic functions) |
(+essay tag; should be obvious, since it's in the proposals cat, but...) |
||
| Line 1: | Line 1: | ||
| + | {{essay}} | ||
| + | |||
According to [[Do notation considered harmful#Safety]] | According to [[Do notation considered harmful#Safety]] | ||
the type of the monadic binding combinator (>>) should be restricted to | the type of the monadic binding combinator (>>) should be restricted to | ||
Current revision
- This page addresses an aspect of Haskell style, which is to some extent a matter of taste. Just pick what you find appropriate for you and ignore the rest.
According to Do notation considered harmful#Safety the type of the monadic binding combinator (>>) should be restricted to
(>>) :: m () -> m a -> m a
_ <-
()
Types of some other monadic operations should be restricted, too.
mapM_ :: Monad m => (a -> m ()) -> [a] -> m () replicateM_ :: Monad m => Int -> m () -> m () sequence_ :: Monad m => [m ()] -> m () zipWithM_ :: Monad m => (a -> b -> m ()) -> [a] -> [b] -> m ()
