module Unison.KindInference.Error.Pretty
  ( prettyKindError,
  )
where

import Unison.ABT qualified as ABT
import Unison.KindInference.Constraint.Pretty
import Unison.KindInference.Error (ConstraintConflict (..), KindError (..))
import Unison.KindInference.UVar (UVar (..))
import Unison.PrettyPrintEnv (PrettyPrintEnv)
import Unison.Type (Type)
import Unison.Util.AnnotatedText qualified as AT
import Unison.Util.ColorText (Color)
import Unison.Util.Pretty (ColorText, Pretty)
import Unison.Util.Pretty qualified as Pr
import Unison.Var (Var)

-- | Pretty print a user-facing @KindError@.
prettyKindError ::
  (Var v) =>
  -- | How to print types
  (Type v loc -> Pretty ColorText) ->
  -- | How to print source spans
  ([(loc, Color)] -> Pretty ColorText) ->
  -- | Contrasting colors used in error message output
  Color ->
  Color ->
  PrettyPrintEnv ->
  KindError v loc ->
  Pretty ColorText
prettyKindError :: forall v loc.
Var v =>
(Type v loc -> Pretty ColorText)
-> ([(loc, Color)] -> Pretty ColorText)
-> Color
-> Color
-> PrettyPrintEnv
-> KindError v loc
-> Pretty ColorText
prettyKindError Type v loc -> Pretty ColorText
prettyType [(loc, Color)] -> Pretty ColorText
showSource Color
color1 Color
color2 PrettyPrintEnv
env = \case
  CycleDetected loc
loc UVar v loc
conflictedVar ConstraintMap v loc
constraints ->
    let annotatedSrc :: Pretty ColorText
annotatedSrc =
          [(loc, Color)] -> Pretty ColorText
showSource
            [ (loc
loc, Color
color2)
            ]
        (Pretty ColorText
prettyVarKind, Pretty ColorText
prettyVarKindConstraint) = PrettyPrintEnv
-> ConstraintMap v loc
-> UVar v loc
-> (Pretty ColorText -> Pretty ColorText)
-> (Pretty ColorText, Pretty ColorText)
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc
-> UVar v loc
-> (Pretty ColorText -> Pretty ColorText)
-> (Pretty ColorText, Pretty ColorText)
prettyCyclicUVarKind PrettyPrintEnv
env ConstraintMap v loc
constraints UVar v loc
conflictedVar (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1)
        theErrMsg :: Pretty ColorText
theErrMsg =
          Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall s.
(ListLike s Char, IsString s) =>
Pretty s -> Pretty s -> Pretty s
Pr.hang
            (Pretty ColorText -> Pretty ColorText
Pr.bold Pretty ColorText
"Cannot construct infinite kind")
            ( Pretty ColorText -> [Pretty ColorText] -> Pretty ColorText
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
Pretty s -> f (Pretty s) -> Pretty s
Pr.sep
                Pretty ColorText
"\n"
                [ Pretty ColorText
annotatedSrc,
                  Pretty ColorText -> Pretty ColorText
forall s. (ListLike s Char, IsString s) => Pretty s -> Pretty s
Pr.wrap
                    ( Pretty ColorText
"The above application constrains the kind of"
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
conflictedVar)
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
"to be infinite, generated by the constraint"
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
prettyVarKindConstraint
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
"where"
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 Pretty ColorText
prettyVarKind
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
"is the kind of"
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
conflictedVar) Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
".")
                    )
                ]
            )
     in Pretty ColorText
theErrMsg
  UnexpectedArgument loc
_loc UVar v loc
abs UVar v loc
arg ConstraintMap v loc
_constraints ->
    let theErrMsg :: Pretty ColorText
theErrMsg =
          Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall s.
(ListLike s Char, IsString s) =>
Pretty s -> Pretty s -> Pretty s
Pr.hang
            (Pretty ColorText -> Pretty ColorText
Pr.bold Pretty ColorText
"Kind mismatch arising from")
            ( Pretty ColorText -> [Pretty ColorText] -> Pretty ColorText
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
Pretty s -> f (Pretty s) -> Pretty s
Pr.sep
                Pretty ColorText
"\n"
                [ Pretty ColorText
annotatedSrc,
                  Pretty ColorText -> Pretty ColorText
forall s. (ListLike s Char, IsString s) => Pretty s -> Pretty s
Pr.wrap
                    ( Pretty ColorText
pabs
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
"doesn't expect an argument; however,"
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
"it is applied to"
                        Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Pretty ColorText
parg Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
".")
                    )
                ]
            )
        annotatedSrc :: Pretty ColorText
annotatedSrc =
          [(loc, Color)] -> Pretty ColorText
showSource
            [ (UVar v loc -> loc
forall {v} {a}. UVar v a -> a
varLoc UVar v loc
abs, Color
color1),
              (UVar v loc -> loc
forall {v} {a}. UVar v a -> a
varLoc UVar v loc
arg, Color
color2)
            ]

        pabs :: Pretty ColorText
pabs = Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
abs)
        parg :: Pretty ColorText
parg = Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
arg)
     in Pretty ColorText
theErrMsg
  ArgumentMismatch UVar v loc
abs UVar v loc
expected UVar v loc
actual ConstraintMap v loc
constraints ->
    let theErrMsg :: Pretty ColorText
theErrMsg =
          Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall s.
(ListLike s Char, IsString s) =>
Pretty s -> Pretty s -> Pretty s
Pr.hang
            (Pretty ColorText -> Pretty ColorText
Pr.bold Pretty ColorText
"Kind mismatch arising from")
            ( Pretty ColorText -> [Pretty ColorText] -> Pretty ColorText
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
Pretty s -> f (Pretty s) -> Pretty s
Pr.sep
                Pretty ColorText
"\n"
                [ Pretty ColorText
annotatedSrc,
                  Pretty ColorText -> Pretty ColorText
forall s. (ListLike s Char, IsString s) => Pretty s -> Pretty s
Pr.wrap
                    ( [Pretty ColorText] -> Pretty ColorText
forall a. Monoid a => [a] -> a
mconcat
                        [ Pretty ColorText
pabs,
                          Pretty ColorText
" expects an argument of kind: ",
                          Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 (PrettyPrintEnv
-> ConstraintMap v loc -> UVar v loc -> Pretty ColorText
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc -> UVar v loc -> Pretty ColorText
prettyUVarKind PrettyPrintEnv
env ConstraintMap v loc
constraints UVar v loc
expected) Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
";"),
                          Pretty ColorText
"however, it is applied to ",
                          Pretty ColorText
parg,
                          Pretty ColorText
"which has kind: ",
                          Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (PrettyPrintEnv
-> ConstraintMap v loc -> UVar v loc -> Pretty ColorText
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc -> UVar v loc -> Pretty ColorText
prettyUVarKind PrettyPrintEnv
env ConstraintMap v loc
constraints UVar v loc
actual) Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
".")
                        ]
                    )
                ]
            )
        annotatedSrc :: Pretty ColorText
annotatedSrc =
          [(loc, Color)] -> Pretty ColorText
showSource
            [ (UVar v loc -> loc
forall {v} {a}. UVar v a -> a
varLoc UVar v loc
abs, Color
color1),
              (UVar v loc -> loc
forall {v} {a}. UVar v a -> a
varLoc UVar v loc
actual, Color
color2)
            ]

        pabs :: Pretty ColorText
pabs = Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
abs)
        parg :: Pretty ColorText
parg = Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
actual)
     in Pretty ColorText
theErrMsg
  ArgumentMismatchArrow (loc
_loc, Type v loc
_cod, Type v loc
_dom) ConstraintConflict' {UVar v loc
conflictedVar :: UVar v loc
$sel:conflictedVar:ConstraintConflict' :: forall v loc. ConstraintConflict v loc -> UVar v loc
conflictedVar, Constraint (UVar v loc) v loc
impliedConstraint :: Constraint (UVar v loc) v loc
$sel:impliedConstraint:ConstraintConflict' :: forall v loc.
ConstraintConflict v loc -> Constraint (UVar v loc) v loc
impliedConstraint, Constraint (UVar v loc) v loc
conflictedConstraint :: Constraint (UVar v loc) v loc
$sel:conflictedConstraint:ConstraintConflict' :: forall v loc.
ConstraintConflict v loc -> Constraint (UVar v loc) v loc
conflictedConstraint} ConstraintMap v loc
constraints ->
    let theErrMsg :: Pretty ColorText
theErrMsg =
          Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall s.
(ListLike s Char, IsString s) =>
Pretty s -> Pretty s -> Pretty s
Pr.hang
            (Pretty ColorText -> Pretty ColorText
Pr.bold Pretty ColorText
"Kind mismatch arising from")
            ( Pretty ColorText -> [Pretty ColorText] -> Pretty ColorText
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
Pretty s -> f (Pretty s) -> Pretty s
Pr.sep
                Pretty ColorText
"\n"
                [ Pretty ColorText
annotatedSrc,
                  Pretty ColorText -> Pretty ColorText
forall s. (ListLike s Char, IsString s) => Pretty s -> Pretty s
Pr.wrap
                    ( [Pretty ColorText] -> Pretty ColorText
forall a. Monoid a => [a] -> a
mconcat
                        [ Pretty ColorText
"The arrow type",
                          Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Pretty ColorText
"(" Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
prettyArrow Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
")"),
                          Pretty ColorText
"expects arguments of kind",
                          Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 (PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
prettySolvedConstraint PrettyPrintEnv
env ConstraintMap v loc
constraints Constraint (UVar v loc) v loc
impliedConstraint) Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
";"),
                          Pretty ColorText
"however, it is applied to",
                          Pretty ColorText
parg,
                          Pretty ColorText
"which has kind:",
                          Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
prettySolvedConstraint PrettyPrintEnv
env ConstraintMap v loc
constraints Constraint (UVar v loc) v loc
conflictedConstraint) Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
".")
                        ]
                    )
                ]
            )
        prettyArrow :: Pretty ColorText
prettyArrow = Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 Pretty ColorText
"->"
        annotatedSrc :: Pretty ColorText
annotatedSrc =
          [(loc, Color)] -> Pretty ColorText
showSource
            [ (UVar v loc -> loc
forall {v} {a}. UVar v a -> a
varLoc UVar v loc
conflictedVar, Color
color2)
            ]

        parg :: Pretty ColorText
parg = Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
conflictedVar)
     in Pretty ColorText
theErrMsg
  EffectListMismatch ConstraintConflict' {UVar v loc
$sel:conflictedVar:ConstraintConflict' :: forall v loc. ConstraintConflict v loc -> UVar v loc
conflictedVar :: UVar v loc
conflictedVar, Constraint (UVar v loc) v loc
$sel:impliedConstraint:ConstraintConflict' :: forall v loc.
ConstraintConflict v loc -> Constraint (UVar v loc) v loc
impliedConstraint :: Constraint (UVar v loc) v loc
impliedConstraint, Constraint (UVar v loc) v loc
$sel:conflictedConstraint:ConstraintConflict' :: forall v loc.
ConstraintConflict v loc -> Constraint (UVar v loc) v loc
conflictedConstraint :: Constraint (UVar v loc) v loc
conflictedConstraint} ConstraintMap v loc
constraints ->
    let theErrMsg :: Pretty ColorText
theErrMsg =
          Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall s.
(ListLike s Char, IsString s) =>
Pretty s -> Pretty s -> Pretty s
Pr.hang
            (Pretty ColorText -> Pretty ColorText
Pr.bold Pretty ColorText
"Kind mismatch arising from")
            ( Pretty ColorText -> [Pretty ColorText] -> Pretty ColorText
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
Pretty s -> f (Pretty s) -> Pretty s
Pr.sep
                Pretty ColorText
"\n"
                [ Pretty ColorText
annotatedSrc,
                  Pretty ColorText -> Pretty ColorText
forall s. (ListLike s Char, IsString s) => Pretty s -> Pretty s
Pr.wrap
                    ( [Pretty ColorText] -> Pretty ColorText
forall a. Monoid a => [a] -> a
mconcat
                        [ Pretty ColorText
"An ability list must consist solely of abilities;",
                          Pretty ColorText
"however, this list contains",
                          Pretty ColorText
parg,
                          Pretty ColorText
"which has kind",
                          Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
prettySolvedConstraint PrettyPrintEnv
env ConstraintMap v loc
constraints Constraint (UVar v loc) v loc
conflictedConstraint) Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
"."),
                          Pretty ColorText
"Abilities are of kind ",
                          Pretty ColorText -> Pretty ColorText
forall s. Pretty s -> Pretty s
Pr.group (Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 (PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
prettySolvedConstraint PrettyPrintEnv
env ConstraintMap v loc
constraints Constraint (UVar v loc) v loc
impliedConstraint) Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Pretty ColorText
".")
                        ]
                    )
                ]
            )
        annotatedSrc :: Pretty ColorText
annotatedSrc =
          [(loc, Color)] -> Pretty ColorText
showSource
            [ (UVar v loc -> loc
forall {v} {a}. UVar v a -> a
varLoc UVar v loc
conflictedVar, Color
color2)
            ]

        parg :: Pretty ColorText
parg = Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (UVar v loc -> Pretty ColorText
prettyTyp UVar v loc
conflictedVar)
     in Pretty ColorText
theErrMsg
  ConstraintConflict GeneratedConstraint v loc
_generatedConstraint ConstraintConflict' {UVar v loc
$sel:conflictedVar:ConstraintConflict' :: forall v loc. ConstraintConflict v loc -> UVar v loc
conflictedVar :: UVar v loc
conflictedVar, Constraint (UVar v loc) v loc
$sel:impliedConstraint:ConstraintConflict' :: forall v loc.
ConstraintConflict v loc -> Constraint (UVar v loc) v loc
impliedConstraint :: Constraint (UVar v loc) v loc
impliedConstraint, Constraint (UVar v loc) v loc
$sel:conflictedConstraint:ConstraintConflict' :: forall v loc.
ConstraintConflict v loc -> Constraint (UVar v loc) v loc
conflictedConstraint :: Constraint (UVar v loc) v loc
conflictedConstraint} ConstraintMap v loc
constraints ->
    let prettySolvedConstraint' :: Constraint (UVar v loc) v loc -> Pretty ColorText
prettySolvedConstraint' Constraint (UVar v loc) v loc
c = Pretty ColorText -> Pretty ColorText
Pr.bold (PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
forall v loc.
Var v =>
PrettyPrintEnv
-> ConstraintMap v loc
-> Constraint (UVar v loc) v loc
-> Pretty ColorText
prettySolvedConstraint PrettyPrintEnv
env ConstraintMap v loc
constraints Constraint (UVar v loc) v loc
c)

        theErrMsg :: Pretty ColorText
theErrMsg =
          Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall s.
(ListLike s Char, IsString s) =>
Pretty s -> Pretty s -> Pretty s
Pr.hang
            (Pretty ColorText -> Pretty ColorText
Pr.bold Pretty ColorText
"Kind mismatch arising from")
            ( Pretty ColorText -> [Pretty ColorText] -> Pretty ColorText
forall (f :: * -> *) s.
(Foldable f, IsString s) =>
Pretty s -> f (Pretty s) -> Pretty s
Pr.sep
                Pretty ColorText
"\n"
                [ Pretty ColorText
annotatedSrc,
                  Pretty ColorText
"Expected kind: " Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color1 (Constraint (UVar v loc) v loc -> Pretty ColorText
prettySolvedConstraint' Constraint (UVar v loc) v loc
impliedConstraint),
                  Pretty ColorText
"Given kind: " Pretty ColorText -> Pretty ColorText -> Pretty ColorText
forall a. Semigroup a => a -> a -> a
<> Color -> Pretty ColorText -> Pretty ColorText
stylePretty Color
color2 (Constraint (UVar v loc) v loc -> Pretty ColorText
prettySolvedConstraint' Constraint (UVar v loc) v loc
conflictedConstraint)
                ]
            )
        annotatedSrc :: Pretty ColorText
annotatedSrc =
          [(loc, Color)] -> Pretty ColorText
showSource
            [ (UVar v loc -> loc
forall {v} {a}. UVar v a -> a
varLoc UVar v loc
conflictedVar, Color
color2)
            ]
     in Pretty ColorText
theErrMsg
  where
    varLoc :: UVar v a -> a
varLoc UVar v a
var = Term F v a -> a
forall (f :: * -> *) v a. Term f v a -> a
ABT.annotation (Term F v a -> a) -> Term F v a -> a
forall a b. (a -> b) -> a -> b
$ UVar v a -> Term F v a
forall v loc. UVar v loc -> Type v loc
uvarType UVar v a
var
    prettyTyp :: UVar v loc -> Pretty ColorText
prettyTyp = Type v loc -> Pretty ColorText
prettyType (Type v loc -> Pretty ColorText)
-> (UVar v loc -> Type v loc) -> UVar v loc -> Pretty ColorText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UVar v loc -> Type v loc
forall v loc. UVar v loc -> Type v loc
uvarType

stylePretty :: Color -> Pretty ColorText -> Pretty ColorText
stylePretty :: Color -> Pretty ColorText -> Pretty ColorText
stylePretty = (ColorText -> ColorText) -> Pretty ColorText -> Pretty ColorText
forall s2 s. ListLike s2 Char => (s -> s2) -> Pretty s -> Pretty s2
Pr.map ((ColorText -> ColorText) -> Pretty ColorText -> Pretty ColorText)
-> (Color -> ColorText -> ColorText)
-> Color
-> Pretty ColorText
-> Pretty ColorText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color -> ColorText -> ColorText
forall a. a -> AnnotatedText a -> AnnotatedText a
AT.annotate