ppTermDepth :: forall t. Termlike t => Int -> t -> Doc
ppTermDepth d0 = pp d0 emptyLocalVarDoc PrecNone
  where
    pp :: Int -> TermPrinter t
    pp 0 _ _ _ = text "_"
    pp d lcls p t = case unwrapTermF t of
      App t1 t2 ->
        ppAppParens p $ group $ hang 2 $
        (pp d lcls PrecApp t1) Leijen.<$>
        (pp (d-1) lcls PrecArg t2)
      tf ->
        ppTermF (pp (d-1)) lcls p tf
ppTermDepth :: forall t. Termlike t => Int -> t -> Doc
ppTermDepth d0 = pp d0 emptyLocalVarDoc PrecNone
  where
    pp :: Int -> TermPrinter t
    pp 0 _ _ _ = text "_"
    pp d lcls p t = case unwrapTermF t of
      App t1 t2 ->
        ppAppParens p $ group $ hang 2 $
        (pp d lcls PrecApp t1) Leijen.<$>
        (pp (d-1) lcls PrecArg t2)
      tf ->
        ppTermF (pp (d-1)) lcls p tf
ppTermDepth d0 = pp d0 emptyLocalVarDoc PrecNone
  where
    pp :: Int -> TermPrinter t
    pp 0 _ _ _ = text "_"
    pp d lcls p t = case unwrapTermF t of
      App t1 t2 ->
        ppAppParens p $ group $ hang 2 $
        (pp d lcls PrecApp t1) Leijen.<$>
        (pp (d-1) lcls PrecArg t2)
      tf ->
        ppTermF (pp (d-1)) lcls p tf