Skip to content

-Wunused-type-patterns warnings have odd SrcSpans

Consider the following program:

{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wunused-type-patterns #-}
module Bug where

type family F a b c
type instance F Char b Int = ()
$ /opt/ghc/8.6.5/bin/ghci Bug.hs
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )

Bug.hs:6:17: warning: [-Wunused-type-patterns]
    Defined but not used: type variable ‘b’
  |
6 | type instance F Char b Int = ()
  |                 ^^^^^^^^^^

Even though the culprit behind this warning is b, the associated SrcSpan points to all of F's type patterns.

Patch incoming.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information