Fix Trac #2856: make deriving work for type families