on master help sign in
Merge pull request #1550 from david-christiansen/pprint-command
f3ecd90David Christiansen
src/Idris/Output.hs+5−2
@@ -201,7 +201,9 @@ renderExternal fmt width doc
201 decorate HTMLOutput (AnnName _ _ _ _) = id
201 decorate HTMLOutput (AnnName _ _ _ _) = id
202 decorate HTMLOutput (AnnBoundName _ True) = tag "idris-bound idris-implicit" Nothing
202 decorate HTMLOutput (AnnBoundName _ True) = tag "idris-bound idris-implicit" Nothing
203 decorate HTMLOutput (AnnBoundName _ False) = tag "idris-bound" Nothing
203 decorate HTMLOutput (AnnBoundName _ False) = tag "idris-bound" Nothing
204− decorate HTMLOutput (AnnConst _) = id -- TODO
204+ decorate HTMLOutput (AnnConst c) =
205+ tag (if constIsType c then "idris-type" else "idris-data")
206+ (Just $ constDocs c)
205 decorate HTMLOutput (AnnData _ _) = tag "idris-data" Nothing
207 decorate HTMLOutput (AnnData _ _) = tag "idris-data" Nothing
206 decorate HTMLOutput (AnnType _ _) = tag "idris-type" Nothing
208 decorate HTMLOutput (AnnType _ _) = tag "idris-type" Nothing
207 decorate HTMLOutput AnnKeyword = tag "idris-keyword" Nothing
209 decorate HTMLOutput AnnKeyword = tag "idris-keyword" Nothing
@@ -222,7 +224,8 @@ renderExternal fmt width doc
222 decorate LaTeXOutput (AnnName _ _ _ _) = id
224 decorate LaTeXOutput (AnnName _ _ _ _) = id
223 decorate LaTeXOutput (AnnBoundName _ True) = latex "IdrisImplicit"
225 decorate LaTeXOutput (AnnBoundName _ True) = latex "IdrisImplicit"
224 decorate LaTeXOutput (AnnBoundName _ False) = latex "IdrisBound"
226 decorate LaTeXOutput (AnnBoundName _ False) = latex "IdrisBound"
225− decorate LaTeXOutput (AnnConst _) = id -- TODO
227+ decorate LaTeXOutput (AnnConst c) =
228+ latex $ if constIsType c then "IdrisType" else "IdrisData"
226 decorate LaTeXOutput (AnnData _ _) = latex "IdrisData"
229 decorate LaTeXOutput (AnnData _ _) = latex "IdrisData"
227 decorate LaTeXOutput (AnnType _ _) = latex "IdrisType"
230 decorate LaTeXOutput (AnnType _ _) = latex "IdrisType"
228 decorate LaTeXOutput AnnKeyword = latex "IdrisKeyword"
231 decorate LaTeXOutput AnnKeyword = latex "IdrisKeyword"
src/Idris/REPL.hs+3−2
@@ -575,6 +575,7 @@ ideslaveProcess fn (Apropos a) = do process fn (Apropos a)
575ideslaveProcess fn (WhoCalls n) = process fn (WhoCalls n)
575ideslaveProcess fn (WhoCalls n) = process fn (WhoCalls n)
576ideslaveProcess fn (CallsWho n) = process fn (CallsWho n)
576ideslaveProcess fn (CallsWho n) = process fn (CallsWho n)
577ideslaveProcess fn (PrintDef n) = process fn (PrintDef n)
577ideslaveProcess fn (PrintDef n) = process fn (PrintDef n)
578+ideslaveProcess fn (PPrint fmt n tm) = process fn (PPrint fmt n tm)
578ideslaveProcess fn _ = iPrintError "command not recognized or not supported"
579ideslaveProcess fn _ = iPrintError "command not recognized or not supported"
579
580
580
581
@@ -1189,7 +1190,7 @@ process fn (PrintDef n) =
1189
1190
1190process fn (PPrint fmt width (PRef _ n))
1191process fn (PPrint fmt width (PRef _ n))
1191 = do outs <- pprintDef n
1192 = do outs <- pprintDef n
1192− iputStrLn =<< renderExternal fmt width (vsep outs)
1193+ iPrintResult =<< renderExternal fmt width (vsep outs)
1193
1194
1194
1195
1195process fn (PPrint fmt width t)
1196process fn (PPrint fmt width t)
@@ -1198,7 +1199,7 @@ process fn (PPrint fmt width t)
1198 ist <- getIState
1199 ist <- getIState
1199 let ppo = ppOptionIst ist
1200 let ppo = ppOptionIst ist
1200 ty' = normaliseC ctxt [] ty
1201 ty' = normaliseC ctxt [] ty
1201− iputStrLn =<< renderExternal fmt width (pprintDelab ist tm)
1202+ iPrintResult =<< renderExternal fmt width (pprintDelab ist tm)
1202
1203
1203
1204
1204showTotal :: Totality -> IState -> String
1205showTotal :: Totality -> IState -> String