module Unison.PatternMatchCoverage.Pretty where import Data.Char import Unison.ConstructorReference (ConstructorReference) import Unison.PrettyPrintEnv import Unison.Symbol import Unison.Syntax.TermPrinter qualified as TermPrinter import Unison.Term qualified as Term import Unison.Util.Pretty import Unison.Util.Pretty qualified as P import Unison.Var prettyVar :: (Var v) => v -> Pretty ColorText prettyVar :: forall v. Var v => v -> Pretty ColorText prettyVar v v = let go :: t -> [Char] go t x = let (t d, t m) = t -> t -> (t, t) forall a. Integral a => a -> a -> (a, a) divMod t x t 26 c :: Char c = Int -> Char chr (Char -> Int ord Char 'a' Int -> Int -> Int forall a. Num a => a -> a -> a + t -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral t m) in Char c Char -> [Char] -> [Char] forall a. a -> [a] -> [a] : case t d of t 0 -> [Char] "" t _ -> t -> [Char] go t d in Pretty ColorText -> Pretty ColorText P.bold (Pretty ColorText -> Pretty ColorText) -> Pretty ColorText -> Pretty ColorText forall a b. (a -> b) -> a -> b $ [Char] -> Pretty ColorText forall s. IsString s => [Char] -> Pretty s string (Word64 -> [Char] forall {t}. Integral t => t -> [Char] go (v -> Word64 forall v. Var v => v -> Word64 freshId v v)) prettyConstructorReference :: PrettyPrintEnv -> ConstructorReference -> Pretty ColorText prettyConstructorReference :: PrettyPrintEnv -> ConstructorReference -> Pretty ColorText prettyConstructorReference PrettyPrintEnv ppe ConstructorReference cr = let con :: Term.Term Symbol () con :: Term Symbol () con = () -> ConstructorReference -> Term Symbol () forall v a vt at ap. Ord v => a -> ConstructorReference -> Term2 vt at ap v a Term.constructor () ConstructorReference cr in PrettyPrintEnv -> Term Symbol () -> Pretty ColorText forall v a. Var v => PrettyPrintEnv -> Term v a -> Pretty ColorText TermPrinter.pretty PrettyPrintEnv ppe Term Symbol () con