-- | Checks whether the evidence can be used to solve a goal with the given minimum depth
-- See Note [Preventing recursive dictionaries]
ctEvCheckDepth :: Class -> CtLoc -> CtEvidence -> Bool
ctEvCheckDepth cls target ev
  | isWanted ev
  , cls == coercibleClass  -- The restriction applies only to Coercible
  = ctLocDepth target <= ctLocDepth (ctEvLoc ev)
  | otherwise = True
ctEvCheckDepth :: Class -> CtLoc -> CtEvidence -> Bool
ctEvCheckDepth cls target ev
  | isWanted ev
  , cls == coercibleClass  -- The restriction applies only to Coercible
  = ctLocDepth target <= ctLocDepth (ctEvLoc ev)
  | otherwise = True
ctEvCheckDepth cls target ev
  | isWanted ev
  , cls == coercibleClass  -- The restriction applies only to Coercible
  = ctLocDepth target <= ctLocDepth (ctEvLoc ev)
  | otherwise = True