Skip to content

More information in occurs check message

$ cat A.hs
module A
  where

foo :: [a] -> a
foo = id
$ ghc -c A.hs

A.hs:5:0:
    Occurs check: cannot construct the infinite type: a = [a]
    When generalising the type(s) for `foo'

It would be nice if GHC could give more information about where and how the error is being generated, for example which expressions are making it try to unify a and [a]. (Especially in more complicated functions, it can be difficult to track down the bug.)

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