Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions message-index/messages/GHC-81995/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Unused "do" bind
summary: A return value of a monadic action is ignored
severity: warning
flag: -Wunused-do-bind
introduced: 9.6.1.
---

Many monadic actions perform side effects before returning a value. For example,
`sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)` performs all
actions in a traversable container and returns the container with the return
values. Sometimes, we are only interested in the side effect of a monadic
actions, and not the return value. In these cases, we should use appropriate
functions indicating that we purposefully ignore the return value.
6 changes: 6 additions & 0 deletions message-index/messages/GHC-81995/sequence/after/GetLine.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module GetLine where

main :: IO ()
main = do
sequence_ [putStrLn "First line", putStrLn "Second line"]
putStrLn "Done."
6 changes: 6 additions & 0 deletions message-index/messages/GHC-81995/sequence/before/GetLine.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module GetLine where

main :: IO ()
main = do
sequence [putStrLn "First line", putStrLn "Second line"]
putStrLn "Done."
3 changes: 3 additions & 0 deletions message-index/messages/GHC-81995/sequence/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Fix warning about unused "do" bind using `sequence_`
---