Skip to content

Duplicate type error messages with implicit parameters

The following ill-typed program generates two identical type errors at the same source location:

{-# LANGUAGE ImplicitParams #-}

foo :: (?x :: Int) => a
foo = undefined

bar =
    let ?x = "hello"
    in foo

The error messages are:

Test.hs:8:8:
    Couldn't match type `Int' with `[Char]'
    In the expression: foo
    In the expression: let ?x = "hello" in foo
    In an equation for `bar': bar = let ?x = "hello" in foo

Test.hs:8:8:
    Couldn't match type `Int' with `[Char]'
    In the expression: foo
    In the expression: let ?x = "hello" in foo
    In an equation for `bar': bar = let ?x = "hello" in foo

Obviously, it should only print this error once. I encountered this in a larger program where it meant I got eight identical type errors at the same source position!

Trac metadata
Trac field Value
Version 7.0.3
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