Do not generate warning in `do` when result is of type `Void`.
GHC generates warnings when do
notation statements discard their
result, without an explicit _ <-
, unless the discarded result
is of type ()
.
Another type which is used to indicate "no result", is Void
from Data.Void
. There are no meaningful values of this type, so we should also skip the warnings for such situations.
Here is an example:
import Data.Void
f :: IO Void
f = undefined
main :: IO ()
main = do f
return ()
GHC output:
test.hs:7:11: Warning:
A do-notation statement discarded a result of type ‘Void’
Suppress this warning by saying ‘_ <- f’
or by using the flag -fno-warn-unused-do-bind
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |