Skip to content

Error message for accidentally using -> instead of =>

Consider the following typo:

sort :: Ord s -> [s] -> [s]
sort xs = Data.List.sort xs

GHC's error message in 7.10 is

    Expected a type, but ‘Ord s’ has kind ‘GHC.Prim.Constraint’
    In the type signature for ‘Main.sort’:
      Main.sort :: Ord s -> [s] -> [s]

I would suggest that mentioning kinds and GHC.Prim.Constraint is a bit unfriendly in a vanilla session (with ConstraintKinds etc switched off).

For comparison, the 6.12 error message was

    Class `Ord' used as a type
    In the type signature for `sort': sort :: Ord a -> [a] -> [a]
Trac metadata
Trac field Value
Version 7.10.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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