{-# LANGUAGE UndecidableInstances #-}
module TypeLevelShow.Utils where
import GHC.TypeLits
type ShowParen :: Bool -> Symbol -> Symbol
type family ShowParen b p where
ShowParen False p = p
ShowParen True p = ConsSymbol '(' p `AppendSymbol` ")"
type ShowParenIfGt :: Natural -> Natural -> Symbol -> Symbol
type ShowParenIfGt n d p = ShowParen (OrderingGT (CmpNat d n)) p
type family OrderingGT (a :: Ordering) :: Bool where
OrderingGT LT = False
OrderingGT EQ = False
OrderingGT GT = True
type ShowChar ch = ConsSymbol ch ""
type l ++ r = AppendSymbol l r
type l > r = OrderingGT (CmpNat l r)