ppTermF' pp lcls p (Lambda name tp rhs) =
    ppLam
      <$> pp lcls  PrecLambda tp
      <*> pp lcls' PrecLambda rhs
  where ppLam tp' rhs' =
          ppParens (p > PrecLambda) $ group $ hang 2 $
            text "\\" <> parens (text name' <> doublecolon <> tp')
              <+> text "->" Leijen.<$> rhs'
        name' = freshVariant (docUsedMap lcls) name
        lcls' = consBinding lcls name'
ppTermF' pp lcls p (Lambda name tp rhs) =
    ppLam
      <$> pp lcls  PrecLambda tp
      <*> pp lcls' PrecLambda rhs
  where ppLam tp' rhs' =
          ppParens (p > PrecLambda) $ group $ hang 2 $
            text "\\" <> parens (text name' <> doublecolon <> tp')
              <+> text "->" Leijen.<$> rhs'
        name' = freshVariant (docUsedMap lcls) name
        lcls' = consBinding lcls name'
ppTermF' pp lcls p (Lambda name tp rhs) =
    ppLam
      <$> pp lcls  PrecLambda tp
      <*> pp lcls' PrecLambda rhs
  where ppLam tp' rhs' =
          ppParens (p > PrecLambda) $ group $ hang 2 $
            text "\\" <> parens (text name' <> doublecolon <> tp')
              <+> text "->" Leijen.<$> rhs'
        name' = freshVariant (docUsedMap lcls) name
        lcls' = consBinding lcls name'