[GHC] #8064: Warning out when "undefined" value has been used.
GHC
ghc-devs at haskell.org
Sat Jan 23 14:36:42 UTC 2016
#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
More information about the ghc-tickets
mailing list