module Ermine.Pretty.Kind
(
prettyHardKind
, prettyKind
, prettySchema
) where
import Bound
import Control.Applicative
import Ermine.Pretty
import Ermine.Syntax.Kind
prettyHardKind :: HardKind -> Doc
prettyHardKind Unboxed = "#"
prettyHardKind Star = "*"
prettyHardKind Constraint = "Γ"
prettyHardKind Rho = "ρ"
prettyHardKind Phi = "φ"
prettyHardKind Native = "!"
prettyKind :: Kind String -> Bool -> Doc
prettyKind (Var nm) _ = text nm
prettyKind (HardKind h) _ = prettyHardKind h
prettyKind (Type k) b = prettyKind k b
prettyKind (l :-> r) b = parensIf b $ prettyKind l True <+> "->" <+> prettyKind r False
prettySchema :: Schema String -> [String] -> Doc
prettySchema (Schema hl b) vs = prettyKind (instantiate (pure . (ns!!)) b) False
where
(ns, _) = chooseNames (const False) hl vs