-- | Version of 'pprHsForAll' that can also print an extra-constraints
-- wildcard, e.g. @_ => a -> Bool@ or @(Show a, _) => a -> String@. This
-- underscore will be printed when the 'Maybe SrcSpan' argument is a 'Just'
-- containing the location of the extra-constraints wildcard. A special
-- function for this is needed, as the extra-constraints wildcard is removed
-- from the actual context and type, and stored in a separate field, thus just
-- printing the type will not print the extra-constraints wildcard.
pprHsForAllExtra :: OutputableBndr name => HsExplicitFlag -> Maybe SrcSpan -> LHsTyVarBndrs name -> LHsContext name -> SDoc
pprHsForAllExtra exp extra qtvs cxt
  | show_forall = forall_part <+> pprHsContextExtra show_extra (unLoc cxt)
  | otherwise   = pprHsContextExtra show_extra (unLoc cxt)
  where
    show_extra  = isJust extra
    show_forall =  opt_PprStyle_Debug
                || (not (null (hsQTvBndrs qtvs)) && is_explicit)
    is_explicit = case exp of {Explicit -> True; Implicit -> False; Qualified -> False}
    forall_part = forAllLit <+> ppr qtvs <> dot
pprHsForAllExtra :: OutputableBndr name => HsExplicitFlag -> Maybe SrcSpan -> LHsTyVarBndrs name -> LHsContext name -> SDoc
pprHsForAllExtra exp extra qtvs cxt
  | show_forall = forall_part <+> pprHsContextExtra show_extra (unLoc cxt)
  | otherwise   = pprHsContextExtra show_extra (unLoc cxt)
  where
    show_extra  = isJust extra
    show_forall =  opt_PprStyle_Debug
                || (not (null (hsQTvBndrs qtvs)) && is_explicit)
    is_explicit = case exp of {Explicit -> True; Implicit -> False; Qualified -> False}
    forall_part = forAllLit <+> ppr qtvs <> dot
pprHsForAllExtra exp extra qtvs cxt
  | show_forall = forall_part <+> pprHsContextExtra show_extra (unLoc cxt)
  | otherwise   = pprHsContextExtra show_extra (unLoc cxt)
  where
    show_extra  = isJust extra
    show_forall =  opt_PprStyle_Debug
                || (not (null (hsQTvBndrs qtvs)) && is_explicit)
    is_explicit = case exp of {Explicit -> True; Implicit -> False; Qualified -> False}
    forall_part = forAllLit <+> ppr qtvs <> dot