Ticket #1050 (closed bug: fixed)
Using an inferred type as a type signature fails
| Reported by: | simonpj | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | _|_ |
| Component: | Compiler (Type checker) | Version: | 6.6 |
| Keywords: | Cc: | a.dcolour@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
See the thread starting here http://www.haskell.org/pipermail/glasgow-haskell-users/2006-December/011714.html. Here's a short example:
class C a b where op :: a -> a -- f :: C a b => a -> a f x = op x
It doesn't get much simpler than that! With the type sig, GHC can't see that the (C a b) provided can satisfy the (C a b1) which arises from the call to op. However, without the constraint, GHC simply abstracts over the constrains arising in the RHS, namely (C a b1), and hence infers the type
f :: C a b1 => a -> a
It is extremely undesirable that the inferred type does not work as a type signature, but I don't see how to fix it easily. It doesn't affect many programs, I think; hence low priority
Change History
Note: See
TracTickets for help on using
tickets.
