[GHC] #11306: Do not generate warning in `do` when result is of type `Void`.

#11306: Do not generate warning in `do` when result is of type `Void`. -------------------------------------+------------------------------------- Reporter: diatchki | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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: {{{#!hs 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 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11306 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11306: Do not generate warning in `do` when result is of type `Void`. -------------------------------------+------------------------------------- Reporter: diatchki | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): I'm not a fan of this warning in the first place, but if anything, I would think it is most important to warn when the discarded value is of type `Void`, since that typically indicates that the following code is unreachable... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11306#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11306: Do not generate warning in `do` when result is of type `Void`. -------------------------------------+------------------------------------- Reporter: diatchki | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * failure: None/Unknown => Incorrect warning at compile-time Comment: Won't fix? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11306#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11306: Do not generate warning in `do` when result is of type `Void`. -------------------------------------+------------------------------------- Reporter: diatchki | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => infoneeded Comment: Iavor, do you have an example illustrating your need here? I agree with comment:1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11306#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC