[GHC] #6022: GHC infers over-general types
GHC
ghc-devs at haskell.org
Wed Nov 26 22:33:07 UTC 2014
#6022: GHC infers over-general types
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone: 7.10.1
Component: Compiler | Version: 7.4.1
Resolution: | Keywords:
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Unknown
Type of failure: | Blocked By:
None/Unknown | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by thomie):
GHC should reject `f` ''without'' type signature, because it also rejects
`f` ''with'' type signature, unless `FlexibleContexts` is enabled.
{{{
Prelude> let f x = x + head -- GHC should complain here
Prelude> :t f
f :: Num ([a] -> a) => ([a] -> a) -> [a] -> a
Prelude> let f :: Num ([a] -> a) => ([a] -> a) -> [a] -> a; f x = x + head
<interactive>:4:10:
Non type-variable argument in the constraint: Num ([a] -> a)
(Use FlexibleContexts to permit this)
In the type signature for ‘f’:
f :: Num ([a] -> a) => ([a] -> a) -> [a] -> a
Prelude> :set -XFlexibleContexts
Prelude> let f :: Num ([a] -> a) => ([a] -> a) -> [a] -> a; f x = x + head
Prelude>
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/6022#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list