HIE evidence for ToJSON instances derived using DeriveAnyClass don't rely on Generic evidence
Summary
HIE files in GHC 9 onwards contain evidence for type class dictionaries. However, this evidence chain doesn't seem complete when we look at instances that are derived using DeriveAnyClass
, default methods, and Generics
.
Steps to reproduce
Compile the following with -fwrite-ide-info
:
{-# language DeriveAnyClass #-}
{-# language DeriveGeneric #-}
module Test where
import Data.Aeson
import GHC.Generics ( Generic )
data T = MkT { fieldName :: Bool }
deriving (Generic, ToJSON, FromJSON)
Next, load the resulting .hie
file with hiedb dump
and search the pretty-printed tree for Generic
. You should find $dGeneric
and $dToJSON
symbols, but no connection between them. This seems to suggest that the ToJSON T
instance doesn't depend on the Generic T
instance, but that's incorrect.
Expected behavior
The evidence for ToJSON T
should mention the evidence for Generic T
.
Environment
- GHC version used: 9.0.1