
#14273: Typed holes' "valid substitutions" suggestions are oblivious to type class constraints -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Tritlo Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler (Type | Version: 8.3 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: #9091, #9479 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by vanto): Replying to [[span(style=color: #FF0000, Tritlo )]]:\\ In GHC 5.0.3 or GHC 6.0, for instance:\\ {{{ Prelude> (\x -> x + _) 3 <interactive>:1: Pattern syntax in expression context: _ }}} This response from the compiler is clear and sufficient.\\ For those who want to go further and find an answer, then they activate Typed Holes in the compiler and start again. {{{ Prelude> f = (\x -> x + _) 2 <interactive>:1:16: error: * Found hole: _ :: a Where: `a' is a rigid type variable bound by the inferred type of f :: Num a => a at <interactive>:1:1-19 * In the second argument of `(+)', namely `_' In the expression: x + _ In the expression: \ x -> x + _ * Relevant bindings include x :: a (bound at <interactive>:1:7) f :: a (bound at <interactive>:1:1) }}} It is better to do as before rather than to do the reverse, ie write {{{-fdefer-type-errors}}} or {{{ -fdefer-typed-holes}}} Being brief, use Typed Holes if needed. I have no retrograde ideas when I say that. I'm thinking of a better use of the compiler. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14273#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler