[GHC] #8064: Warning out when "undefined" value has been used.

#8064: Warning out when "undefined" value has been used. ------------------------------------+------------------------------------- Reporter: freizl | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- Programmer may like to use "undefined" to define a function or value, which usually means "later implementation". However, people might forget to implement it thus cause run time error. Wish GHC will show some warning/errors at compilation. This idea comes from this article (http://www.devalot.com/articles/2013/07 /why-haskell.html) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8064 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8064: Warning out when "undefined" value has been used. -------------------------------------+------------------------------------- Reporter: freizl | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: wontfix | 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: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => wontfix Comment: It's much better to use [https://downloads.haskell.org/~ghc/7.10.3/docs/html/users_guide/typed- holes.html typed holes] instead of `undefined` for this purpose, since it will give you the warning you requested. {{{#!hs f :: Int f = _ main = print f }}} {{{ $ ghc-7.10.3 -fdefer-typed-holes Test.hs [1 of 1] Compiling Main ( Test.hs, Test.o ) Test.hs:2:5: Warning: Found hole â_â with type: Int Relevant bindings include f :: Int (bound at Test.hs:2:1) In the expression: _ In an equation for âfâ: f = _ Linking Test ... }}} To suppress the warning, use `-fno-warn-typed-holes`. Given that these flags now exist, I'm closing this as wontfix. See #11482 for a request to turn `-fdefer-typed-holes` on by default. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8064#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC