Skip to content

signatures are too permissive

ghc should reject the following (accidentally mistyped) signature, unless -XFlexibleContexts is used.

flex :: Int -> Show a => a -> String
flex i a = show a ++ show i

hugs and ghc version below 7 rejected this correctly:

    All of the type variables in the constraint `Show a'
    are already in scope (at least one must be universally quantified here)
        (Use -XFlexibleContexts to lift this restriction)
    In the type signature for `flex':
      flex :: Int -> (Show a) => a -> String

It is not Haskell98 nor Haskell2010 (I believe).

Trac metadata
Trac field Value
Version 7.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information