Skip to content

"Unlikely constraint" recognition

Some constraints or combinations are relatively unlikely to appear in correct code, or at least correct code written by beginners. A few tiny examples:

(Integral a, Fractional a) =>  -- Possible, but rare, in correct code.
(Integral a, RealFloat a) =>   -- Rather less possible in correct code.
(Num a, Foldable a) =>  -- Possible, but unlikely for a beginner.
(Fractional [a]) =>
(Show (A -> B)) =>

The current error messages when constraints like these are not satisfied does nothing to suggest that they are unlikely to be correct or to explain to a beginner what kinds of mistakes can lead to errors like this. I imagine some people who teach classes using Haskell will have an idea of which specific things are worth singling out for a special explanation.

Trac metadata
Trac field Value
Version 7.8.3
Type FeatureRequest
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