@@ -176,6 +176,7 @@ data OutputAnnotation = AnnName Name (Maybe NameOutput) (Maybe String) (Maybe St
176176data ErrorReportPart = TextPart String
177177 | NamePart Name
178178 | TermPart Term
179+ | RawPart Raw
179180 | SubReport [ErrorReportPart]
180181 deriving (Show, Eq, Data, Typeable)
181182
@@ -244,7 +245,7 @@ data Err' t
244245 | LoadingFailed String (Err' t)
245246 | ReflectionError [[ErrorReportPart]] (Err' t)
246247 | ReflectionFailed String (Err' t)
247− | ElabScriptDebug (Maybe String) t [(Name, t, [(Name, Binder t)])]
248+ | ElabScriptDebug [ErrorReportPart] t [(Name, t, [(Name, Binder t)])]
248249 -- ^ User-specified message, proof term, goals with context (first goal is focused)
249250 | ElabScriptStuck t
250251 deriving (Eq, Functor, Data, Typeable)
@@ -288,6 +289,7 @@ deriving instance NFData Err
288289instance Sized ErrorReportPart where
289290 size (TextPart msg) = 1 + length msg
290291 size (TermPart t) = 1 + size t
292+ size (RawPart r) = 1 + size r
291293 size (NamePart n) = 1 + size n
292294 size (SubReport rs) = 1 + size rs
293295
@@ -1715,6 +1717,53 @@ pprintTT bound tm = pp startPrec bound tm
17151717 | outer > inner = lparen <> doc <> rparen
17161718 | otherwise = doc
17171719
1720+-- | Pretty-print a raw term.
1721+pprintRaw :: [Name] -- ^ Bound names, for highlighting
1722+ -> Raw -- ^ The term to pretty-print
1723+ -> Doc OutputAnnotation
1724+pprintRaw bound (Var n) =
1725+ enclose lparen rparen . group . align . hang 2 $
1726+ (text "Var") <$> annotate (if n `elem` bound
1727+ then AnnBoundName n False
1728+ else AnnName n Nothing Nothing Nothing)
1729+ (text $ show n)
1730+pprintRaw bound (RBind n b body) =
1731+ enclose lparen rparen . group . align . hang 2 $
1732+ vsep [ text "RBind"
1733+ , annotate (AnnBoundName n False) (text $ show n)
1734+ , ppb b
1735+ , pprintRaw (n:bound) body]
1736+ where
1737+ ppb (Lam ty) = enclose lparen rparen . group . align . hang 2 $
1738+ text "Lam" <$> pprintRaw bound ty
1739+ ppb (Pi _ ty k) = enclose lparen rparen . group . align . hang 2 $
1740+ vsep [text "Pi", pprintRaw bound ty, pprintRaw bound k]
1741+ ppb (Let ty v) = enclose lparen rparen . group . align . hang 2 $
1742+ vsep [text "Let", pprintRaw bound ty, pprintRaw bound v]
1743+ ppb (NLet ty v) = enclose lparen rparen . group . align . hang 2 $
1744+ vsep [text "NLet", pprintRaw bound ty, pprintRaw bound v]
1745+ ppb (Hole ty) = enclose lparen rparen . group . align . hang 2 $
1746+ text "Hole" <$> pprintRaw bound ty
1747+ ppb (GHole _ ty) = enclose lparen rparen . group . align . hang 2 $
1748+ text "GHole" <$> pprintRaw bound ty
1749+ ppb (Guess ty v) = enclose lparen rparen . group . align . hang 2 $
1750+ vsep [text "Guess", pprintRaw bound ty, pprintRaw bound v]
1751+ ppb (PVar ty) = enclose lparen rparen . group . align . hang 2 $
1752+ text "PVar" <$> pprintRaw bound ty
1753+ ppb (PVTy ty) = enclose lparen rparen . group . align . hang 2 $
1754+ text "PVTy" <$> pprintRaw bound ty
1755+pprintRaw bound (RApp f x) =
1756+ enclose lparen rparen . group . align . hang 2 . vsep $
1757+ [text "RApp", pprintRaw bound f, pprintRaw bound x]
1758+pprintRaw bound RType = text "RType"
1759+pprintRaw bound (RUType u) = enclose lparen rparen . group . align . hang 2 $
1760+ text "RUType" <$> text (show u)
1761+pprintRaw bound (RForce r) =
1762+ enclose lparen rparen . group . align . hang 2 $
1763+ vsep [text "RForce", pprintRaw bound r]
1764+pprintRaw bound (RConstant c) =
1765+ enclose lparen rparen . group . align . hang 2 $
1766+ vsep [text "RConstant", annotate (AnnConst c) (text (show c))]
17181767
17191768-- | Pretty-printer helper for the binding site of a name
17201769bindingOf :: Name -- ^^ the bound name