• Tao He's avatar
    Normalize the element type of ListPat, fix #14547 · 361d23a8
    Tao He authored
    The element type of `List` maybe a type family instacen, rather than a
    trivial type.  For example in Trac #14547,
    {-# LANGUAGE TypeFamilies, OverloadedLists #-}
    class Foo f where
            type It f
            foo :: [It f] -> f
    data List a = Empty | a :! List a deriving Show
    instance Foo (List a) where
            type It (List a) = a
            foo [] = Empty
            foo (x : xs) = x :! foo xs
    Here the element type of `[]` is `It (List a)`, we should also normalize
    it as `a`.
    Test Plan: make test TEST="T14547"
    Reviewers: bgamari
    Reviewed By: bgamari
    Subscribers: thomie, carter
    GHC Trac Issues: #14547
    Differential Revision: https://phabricator.haskell.org/D4624