• Richard Eisenberg's avatar
    Track visibility in TypeEqOrigin · fb752133
    Richard Eisenberg authored
    A type equality error can arise from a mismatch between
    *invisible* arguments just as easily as from visible arguments.
    But we should really prefer printing out errors from visible
    arguments over invisible ones. Suppose we have a mismatch between
    `Proxy Int` and `Proxy Maybe`. Would you rather get an error
    between `Int` and `Maybe`? Or between `*` and `* -> *`? I thought
    so, too.
    There is a fair amount of plumbing with this one, but I think
    it's worth it.
    This commit introduces a performance regression in test
    perf/compiler/T5631. The cause of the regression is not the
    new visibility stuff, directly: it's due to a change from
    zipWithM to zipWith3M in TcUnify. To my surprise, zipWithM
    is nicely optimized (it fuses away), but zipWith3M is not.
    There are other examples of functions that could be made faster,
    so I've posted a separate ticket, #14037, to track these
    improvements. For now, I've accepted the small (6.6%) regression.
TcErrors.hs 123 KB