Skip to content

Conversation

StillerHarpo
Copy link
Contributor

@StillerHarpo StillerHarpo commented Oct 13, 2024

We need a better example here. It seems to be this warning only occurs with nested returns. I tried

f = do
  return (putStrLn "text")
  return ()

which didn't produce that warning

---

When using a monadic computation in a do block one should either run it
directly or bind it. If neither is done the monadic computation is never
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
directly or bind it. If neither is done the monadic computation is never
directly or bind the result of the computation to a variable. If neither is done the monadic computation is never

Comment on lines +1 to +2

---
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
---
---

title: Double return
---

In this example, there is a nested return which is not bound. Therefore the computation `return 10` is not used and can be removed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this example, there is a nested return which is not bound. Therefore the computation `return 10` is not used and can be removed.
In this example, there is a nested return whose result is not bound to a variable. Therefore the computation `return 10` is not used and can be removed.

Copy link
Collaborator

@BinderDavid BinderDavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@BinderDavid BinderDavid merged commit e10833e into haskellfoundation:main Oct 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants