[GHC] #9479: Report required constraints when reporting the type of a hole
GHC
ghc-devs at haskell.org
Thu Dec 25 01:30:03 UTC 2014
#9479: Report required constraints when reporting the type of a hole
-------------------------------------+-------------------------------------
Reporter: | Owner:
dominiquedevriese | Status: new
Type: feature | Milestone:
request | Version: 7.8.3
Priority: low | Keywords: holes
Component: Compiler | Architecture: Unknown/Multiple
(Type checker) | Difficulty: Unknown
Resolution: | Blocked By:
Operating System: | Related Tickets:
Unknown/Multiple |
Type of failure: |
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by phadej):
With `-fdefer-type-errors` GHC (both 7.8 and 7.10) tries a bit longer and
finds the missing instance:
{{{
[1 of 1] Compiling Test ( /Users/ogre/show.hs,
/Users/ogre/show.o )
/Users/ogre/show.hs:4:8: Warning:
No instance for (Show a0) arising from a use of ‘show’
The type variable ‘a0’ is ambiguous
Note: there are several potential instances:
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 22 others
In the expression: show _h
In an equation for ‘test’: test = show _h
/Users/ogre/show.hs:4:13: Warning:
Found hole ‘_h’
with type: a0
Where: ‘a0’ is an ambiguous type variable
Relevant bindings include
test :: String (bound at /Users/ogre/show.hs:4:1)
In the first argument of ‘show’, namely ‘_h’
In the expression: show _h
In an equation for ‘test’: test = show _h
}}}
So should we make holeReporter to try to find //Dicts// errors too, if
`-fdefer-type-errors` is not set? IMHO the //No instance// error is what
we need here.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9479#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list