@@ -95,6 +95,28 @@ defaultOpts = IOption { opt_logLevel = 0
95 , opt_autoSolve = True
95 , opt_autoSolve = True
98+data PPOption = PPOption {
99+ ppopt_impl :: Bool -- ^^ whether to show implicits
102+-- | Pretty printing options with default verbosity.
103+defaultPPOption :: PPOption
104+defaultPPOption = PPOption { ppopt_impl = False }
106+-- | Pretty printing options with the most verbosity.
107+verbosePPOption :: PPOption
108+verbosePPOption = PPOption { ppopt_impl = True }
110+-- | Get pretty printing options from the big options record.
111+ppOption :: IOption -> PPOption
112+ppOption opt = PPOption {
113+ ppopt_impl = opt_showimp opt
116+-- | Get pretty printing options from an idris state record.
117+ppOptionIst :: IState -> PPOption
118+ppOptionIst = ppOption . idris_options
98data LanguageExt = TypeProviders | ErrorReflection deriving (Show, Eq, Read, Ord)
120data LanguageExt = TypeProviders | ErrorReflection deriving (Show, Eq, Read, Ord)
100-- | The output mode in use
122-- | The output mode in use
@@ -127,6 +149,7 @@ data IState = IState {
127 idris_tyinfodata :: Ctxt TIData,
149 idris_tyinfodata :: Ctxt TIData,
128 idris_totcheck :: [(FC, Name)], -- names to check totality on
150 idris_totcheck :: [(FC, Name)], -- names to check totality on
129 idris_defertotcheck :: [(FC, Name)], -- names to check at the end
151 idris_defertotcheck :: [(FC, Name)], -- names to check at the end
152+ idris_totcheckfail :: [(FC, String)],
130 idris_options :: IOption,
153 idris_options :: IOption,
131 idris_name :: Int,
154 idris_name :: Int,
132 idris_lineapps :: [((FilePath, Int), PTerm)],
155 idris_lineapps :: [((FilePath, Int), PTerm)],
@@ -231,6 +254,7 @@ data IBCWrite = IBCFix FixDecl
231 | IBCErrorHandler Name
254 | IBCErrorHandler Name
232 | IBCFunctionErrorHandler Name Name Name
255 | IBCFunctionErrorHandler Name Name Name
233 | IBCPostulate Name
256 | IBCPostulate Name
257+ | IBCTotCheckErr FC String
234 deriving Show
258 deriving Show
236-- | The initial state for the compiler
260-- | The initial state for the compiler
@@ -239,7 +263,7 @@ idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
239 emptyContext emptyContext emptyContext emptyContext
263 emptyContext emptyContext emptyContext emptyContext
240 emptyContext emptyContext emptyContext emptyContext
264 emptyContext emptyContext emptyContext emptyContext
241 emptyContext emptyContext
265 emptyContext emptyContext
242− [] [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] [] []
266+ [] [] [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] [] []
243 [] [] Nothing [] Nothing [] [] Nothing [] Hidden False [] Nothing [] [] RawOutput
267 [] [] Nothing [] Nothing [] [] Nothing [] Hidden False [] Nothing [] [] RawOutput
244 True defaultTheme stdout [] (0, emptyContext) emptyContext M.empty
268 True defaultTheme stdout [] (0, emptyContext) emptyContext M.empty
245 AutomaticWidth S.empty Nothing Nothing
269 AutomaticWidth S.empty Nothing Nothing
@@ -264,7 +288,7 @@ data Command = Quit
265 | Eval PTerm
289 | Eval PTerm
266 | Check PTerm
290 | Check PTerm
267− | DocStr Name
291+ | DocStr (Either Name Const)
268 | TotCheck Name
292 | TotCheck Name
270 | Load FilePath
294 | Load FilePath
@@ -297,9 +321,9 @@ data Command = Quit
297 | AddProofClauseFrom Bool Int Name
321 | AddProofClauseFrom Bool Int Name
298 | AddMissing Bool Int Name
322 | AddMissing Bool Int Name
299 | MakeWith Bool Int Name
323 | MakeWith Bool Int Name
300− | DoProofSearch Bool -- ^ update
324+ | DoProofSearch Bool Bool Int Name [Name]
301− Bool -- ^ recursive (i.e. do arguments too)
325+ -- ^ the first bool is whether to update,
302− Int Name [Name]
326+ -- the second is whether to search recursively (i.e. for the arguments)
303 | SetOpt Opt
327 | SetOpt Opt
304 | UnsetOpt Opt
328 | UnsetOpt Opt
@@ -717,8 +741,8 @@ data PTactic' t = Intro [Name] | Intros | Focus Name
717 | MatchRefine Name
741 | MatchRefine Name
718 | LetTac Name t | LetTacTy Name t t
742 | LetTac Name t | LetTacTy Name t t
719 | Exact t | Compute | Trivial | TCInstance
743 | Exact t | Compute | Trivial | TCInstance
720− | ProofSearch Bool -- ^ recursive
721− (Maybe Name) [Name]
744+ | ProofSearch Bool (Maybe Name) [Name]
745+ -- ^ the bool is whether to search recursively
724 | ProofState | ProofTerm | Undo
748 | ProofState | ProofTerm | Undo
@@ -1089,29 +1113,31 @@ piBindp p ((n, ty):ns) t = PPi p n ty (piBindp p ns t)
1089-- could interfere with interactive editing, which calls "show".
1113-- could interfere with interactive editing, which calls "show".
1091instance Show PTerm where
1115instance Show PTerm where
1092− showsPrec _ tm = (displayS . renderPretty 1.0 10000000 . prettyImp False) tm
1116+ showsPrec _ tm = (displayS . renderPretty 1.0 10000000 . prettyImp defaultPPOption) tm
1094instance Show PDecl where
1118instance Show PDecl where
1095− showsPrec _ d = (displayS . renderPretty 1.0 10000000 . showDeclImp False) d
1119+ showsPrec _ d = (displayS . renderPretty 1.0 10000000 . showDeclImp defaultPPOption) d
1097instance Show PClause where
1121instance Show PClause where
1098− showsPrec _ c = (displayS . renderPretty 1.0 10000000 . showCImp True) c
1122+ showsPrec _ c = (displayS . renderPretty 1.0 10000000 . showCImp verbosePPOption) c
1100instance Show PData where
1124instance Show PData where
1101− showsPrec _ d = (displayS . renderPretty 1.0 10000000 . showDImp False) d
1125+ showsPrec _ d = (displayS . renderPretty 1.0 10000000 . showDImp defaultPPOption) d
1103instance Pretty PTerm OutputAnnotation where
1127instance Pretty PTerm OutputAnnotation where
1104− pretty = prettyImp False
1128+ pretty = prettyImp defaultPPOption
1106-- | Colourise annotations according to an Idris state. It ignores the names
1130-- | Colourise annotations according to an Idris state. It ignores the names
1107-- in the annotation, as there's no good way to show extended information on a
1131-- in the annotation, as there's no good way to show extended information on a
1108-- terminal.
1132-- terminal.
1109consoleDecorate :: IState -> OutputAnnotation -> String -> String
1133consoleDecorate :: IState -> OutputAnnotation -> String -> String
1110consoleDecorate ist _ | not (idris_colourRepl ist) = id
1134consoleDecorate ist _ | not (idris_colourRepl ist) = id
1111−consoleDecorate ist AnnConstData = let theme = idris_colourTheme ist
1135+consoleDecorate ist (AnnConst c) = let theme = idris_colourTheme ist
1136+ in if constIsType c
1137+ then colouriseType theme
1112− in colouriseData theme
1138+ else colouriseData theme
1113−consoleDecorate ist AnnConstType = let theme = idris_colourTheme ist
1139+consoleDecorate ist (AnnData _ _) = colouriseData (idris_colourTheme ist)
1114− in colouriseType theme
1140+consoleDecorate ist (AnnType _ _) = colouriseType (idris_colourTheme ist)
1115consoleDecorate ist (AnnBoundName _ True) = colouriseImplicit (idris_colourTheme ist)
1141consoleDecorate ist (AnnBoundName _ True) = colouriseImplicit (idris_colourTheme ist)
1116consoleDecorate ist (AnnBoundName _ False) = colouriseBound (idris_colourTheme ist)
1142consoleDecorate ist (AnnBoundName _ False) = colouriseBound (idris_colourTheme ist)
1117consoleDecorate ist AnnKeyword = colouriseKeyword (idris_colourTheme ist)
1143consoleDecorate ist AnnKeyword = colouriseKeyword (idris_colourTheme ist)
@@ -1129,23 +1155,23 @@ consoleDecorate ist (AnnTextFmt fmt) = Idris.Colours.colourise (colour fmt)
1129 colour ItalicText = IdrisColour Nothing True False False True
1155 colour ItalicText = IdrisColour Nothing True False False True
1131-- | Pretty-print a high-level closed Idris term with no information about precedence/associativity
1157-- | Pretty-print a high-level closed Idris term with no information about precedence/associativity
1132−prettyImp :: Bool -- ^^ whether to show implicits
1158+prettyImp :: PPOption -- ^^ pretty printing options
1133 -> PTerm -- ^^ the term to pretty-print
1159 -> PTerm -- ^^ the term to pretty-print
1134 -> Doc OutputAnnotation
1160 -> Doc OutputAnnotation
1135prettyImp impl = pprintPTerm impl [] [] []
1161prettyImp impl = pprintPTerm impl [] [] []
1137-- | Do the right thing for rendering a term in an IState
1163-- | Do the right thing for rendering a term in an IState
1138prettyIst :: IState -> PTerm -> Doc OutputAnnotation
1164prettyIst :: IState -> PTerm -> Doc OutputAnnotation
1139−prettyIst ist = pprintPTerm (opt_showimp (idris_options ist)) [] [] (idris_infixes ist)
1165+prettyIst ist = pprintPTerm (ppOptionIst ist) [] [] (idris_infixes ist)
1141-- | Pretty-print a high-level Idris term in some bindings context with infix info
1167-- | Pretty-print a high-level Idris term in some bindings context with infix info
1142−pprintPTerm :: Bool -- ^^ whether to show implicits
1168+pprintPTerm :: PPOption -- ^^ pretty printing options
1143 -> [(Name, Bool)] -- ^^ the currently-bound names and whether they are implicit
1169 -> [(Name, Bool)] -- ^^ the currently-bound names and whether they are implicit
1144 -> [Name] -- ^^ names to always show in pi, even if not used
1170 -> [Name] -- ^^ names to always show in pi, even if not used
1145 -> [FixDecl] -- ^^ Fixity declarations
1171 -> [FixDecl] -- ^^ Fixity declarations
1146 -> PTerm -- ^^ the term to pretty-print
1172 -> PTerm -- ^^ the term to pretty-print
1147 -> Doc OutputAnnotation
1173 -> Doc OutputAnnotation
1148−pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1174+pprintPTerm ppo bnd docArgs infixes = prettySe 10 bnd
1150 prettySe :: Int -> [(Name, Bool)] -> PTerm -> Doc OutputAnnotation
1176 prettySe :: Int -> [(Name, Bool)] -> PTerm -> Doc OutputAnnotation
1151 prettySe p bnd (PQuote r) =
1177 prettySe p bnd (PQuote r) =
@@ -1153,8 +1179,8 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1153 prettySe p bnd (PPatvar fc n) = pretty n
1179 prettySe p bnd (PPatvar fc n) = pretty n
1154 prettySe p bnd e
1180 prettySe p bnd e
1155 | Just str <- slist p bnd e = str
1181 | Just str <- slist p bnd e = str
1156− | Just n <- snat p e = annotate AnnConstData (text (show n))
1182+ | Just n <- snat p e = annotate (AnnData "Nat" "") (text (show n))
1157− prettySe p bnd (PRef fc n) = prettyName impl bnd n
1183+ prettySe p bnd (PRef fc n) = prettyName (ppopt_impl ppo) bnd n
1158 prettySe p bnd (PLam n ty sc) =
1184 prettySe p bnd (PLam n ty sc) =
1159 bracket p 2 . group . align . hang 2 $
1185 bracket p 2 . group . align . hang 2 $
1160 text "\\" <> bindingOf n False <+> text "=>" <$>
1186 text "\\" <> bindingOf n False <+> text "=>" <$>
@@ -1165,20 +1191,20 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1165 prettySe 10 bnd v <+> kwd "in" </>
1191 prettySe 10 bnd v <+> kwd "in" </>
1166 prettySe 10 ((n, False):bnd) sc
1192 prettySe 10 ((n, False):bnd) sc
1167 prettySe p bnd (PPi (Exp l s _) n ty sc)
1193 prettySe p bnd (PPi (Exp l s _) n ty sc)
1168− | n `elem` allNamesIn sc || impl || n `elem` docArgs =
1194+ | n `elem` allNamesIn sc || ppopt_impl ppo || n `elem` docArgs =
1169 bracket p 2 . group $
1195 bracket p 2 . group $
1170 enclose lparen rparen (group . align $ bindingOf n False <+> colon <+> prettySe 10 bnd ty) <+>
1196 enclose lparen rparen (group . align $ bindingOf n False <+> colon <+> prettySe 10 bnd ty) <+>
1171 st <> text "->" <$> prettySe 10 ((n, False):bnd) sc
1197 st <> text "->" <$> prettySe 10 ((n, False):bnd) sc
1172 | otherwise =
1198 | otherwise =
1173 bracket p 2 . group $
1199 bracket p 2 . group $
1174− group (prettySe 0 bnd ty <+> st) <> text "->" <$> group (prettySe 10 ((n, False):bnd) sc)
1200+ group (prettySe 1 bnd ty <+> st) <> text "->" <$> group (prettySe 10 ((n, False):bnd) sc)
1177 case s of
1203 case s of
1178 Static -> text "[static]" <> space
1204 Static -> text "[static]" <> space
1179 _ -> empty
1205 _ -> empty
1180 prettySe p bnd (PPi (Imp l s _) n ty sc)
1206 prettySe p bnd (PPi (Imp l s _) n ty sc)
1181− | impl =
1207+ | ppopt_impl ppo =
1182 bracket p 2 $
1208 bracket p 2 $
1183 lbrace <> bindingOf n True <+> colon <+> prettySe 10 bnd ty <> rbrace <+>
1209 lbrace <> bindingOf n True <+> colon <+> prettySe 10 bnd ty <> rbrace <+>
1184 st <> text "->" </> prettySe 10 ((n, True):bnd) sc
1210 st <> text "->" </> prettySe 10 ((n, True):bnd) sc
@@ -1197,16 +1223,16 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1197 rbrace <+> text "->" </> prettySe 10 ((n, True):bnd) sc
1223 rbrace <+> text "->" </> prettySe 10 ((n, True):bnd) sc
1198 prettySe p bnd (PApp _ (PRef _ f) args) -- normal names, no explicit args
1224 prettySe p bnd (PApp _ (PRef _ f) args) -- normal names, no explicit args
1199 | UN nm <- basename f
1225 | UN nm <- basename f
1226+ , not (ppopt_impl ppo) && null (getExps args) =
1200− , not impl && null (getExps args) = if isAlpha (thead nm)
1227+ if isAlpha (thead nm)
1201− then prettyName impl bnd f
1228+ then prettyName (ppopt_impl ppo) bnd f
1202− else enclose lparen rparen $
1229+ else enclose lparen rparen $ prettyName (ppopt_impl ppo) bnd f
1203− prettyName impl bnd f
1204 prettySe p bnd (PAppBind _ (PRef _ f) [])
1230 prettySe p bnd (PAppBind _ (PRef _ f) [])
1205− | not impl = text "!" <> prettyName impl bnd f
1231+ | not (ppopt_impl ppo) = text "!" <> prettyName (ppopt_impl ppo) bnd f
1206− prettySe p bnd (PApp _ (PRef _ op) args)
1232+ prettySe p bnd (PApp _ (PRef _ op) args) -- infix operators
1207 | UN nm <- basename op
1233 | UN nm <- basename op
1208 , not (tnull nm) &&
1234 , not (tnull nm) &&
1209− (not impl) && (not $ isAlpha (thead nm)) =
1235+ (not (ppopt_impl ppo)) && (not $ isAlpha (thead nm)) =
1210 case getExps args of
1236 case getExps args of
1211 [] -> enclose lparen rparen opName
1237 [] -> enclose lparen rparen opName
1212 [x] -> group (enclose lparen rparen opName <$> group (prettySe 0 bnd x))
1238 [x] -> group (enclose lparen rparen opName <$> group (prettySe 0 bnd x))
@@ -1215,7 +1241,7 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1215 (l:r:rest) -> bracket p 1 $
1241 (l:r:rest) -> bracket p 1 $
1216 enclose lparen rparen (inFix l r) <+>
1242 enclose lparen rparen (inFix l r) <+>
1217 align (group (vsep (map (prettyArgSe bnd) rest)))
1243 align (group (vsep (map (prettyArgSe bnd) rest)))
1218− where opName = prettyName impl bnd op
1244+ where opName = prettyName (ppopt_impl ppo) bnd op
1219 f = getFixity (opStr op)
1245 f = getFixity (opStr op)
1220 left l = case f of
1246 left l = case f of
1221 Nothing -> prettySe (-1) bnd l
1247 Nothing -> prettySe (-1) bnd l
@@ -1227,15 +1253,16 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1227 Just f' -> prettySe (prec f'-1) bnd r
1253 Just f' -> prettySe (prec f'-1) bnd r
1228 inFix l r = align . group $
1254 inFix l r = align . group $
1229 (left l <+> opName) <$> group (right r)
1255 (left l <+> opName) <$> group (right r)
1230− prettySe p bnd (PApp _ hd@(PRef fc f) [tm])
1256+ prettySe p bnd (PApp _ hd@(PRef fc f) [tm]) -- symbols, like 'foo
1231 | PConstant (Idris.Core.TT.Str str) <- getTm tm,
1257 | PConstant (Idris.Core.TT.Str str) <- getTm tm,
1258+ f == sUN "Symbol_" = annotate (AnnType ("'" ++ str) ("The symbol " ++ str)) $
1232− f == sUN "Symbol_" = char '\'' <> prettySe 10 bnd (PRef fc (sUN str))
1259+ char '\'' <> prettySe 10 bnd (PRef fc (sUN str))
1233− prettySe p bnd (PApp _ f as) =
1260+ prettySe p bnd (PApp _ f as) = -- Normal prefix applications
1234 let args = getExps as
1261 let args = getExps as
1235 fp = prettySe 1 bnd f
1262 fp = prettySe 1 bnd f
1237 bracket p 1 . group $
1264 bracket p 1 . group $
1238− if impl
1265+ if ppopt_impl ppo
1239 then if null as
1266 then if null as
1241 else fp <+> align (vsep (map (prettyArgS bnd) as))
1268 else fp <+> align (vsep (map (prettyArgS bnd) as))
@@ -1297,13 +1324,8 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1298 prettyAs =
1325 prettyAs =
1299 foldr (\l -> \r -> l <+> text "," <+> r) empty $ map (prettySe 10 bnd) as
1326 foldr (\l -> \r -> l <+> text "," <+> r) empty $ map (prettySe 10 bnd) as
1300− prettySe p bnd PType = annotate AnnConstType $ text "Type"
1327+ prettySe p bnd PType = annotate (AnnType "Type" "The type of types") $ text "Type"
1301− prettySe p bnd (PConstant c) = annotate (annot c) (text (show c))
1328+ prettySe p bnd (PConstant c) = annotate (AnnConst c) (text (show c))
1302− where annot (AType _) = AnnConstType
1303− annot StrType = AnnConstType
1304− annot PtrType = AnnConstType
1305− annot VoidType = AnnConstType
1306− annot _ = AnnConstData
1307 -- XXX: add pretty for tactics
1329 -- XXX: add pretty for tactics
1308 prettySe p bnd (PProof ts) =
1330 prettySe p bnd (PProof ts) =
1309 text "proof" <+> lbrace <> nest nestingSize (text . show $ ts) <> rbrace
1331 text "proof" <+> lbrace <> nest nestingSize (text . show $ ts) <> rbrace
@@ -1340,9 +1362,9 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1340 basename n = n
1362 basename n = n
1342 slist' p bnd (PApp _ (PRef _ nil) _)
1364 slist' p bnd (PApp _ (PRef _ nil) _)
1343− | not impl && nsroot nil == sUN "Nil" = Just []
1365+ | not (ppopt_impl ppo) && nsroot nil == sUN "Nil" = Just []
1344 slist' p bnd (PRef _ nil)
1366 slist' p bnd (PRef _ nil)
1345− | not impl && nsroot nil == sUN "Nil" = Just []
1367+ | not (ppopt_impl ppo) && nsroot nil == sUN "Nil" = Just []
1346 slist' p bnd (PApp _ (PRef _ cons) args)
1368 slist' p bnd (PApp _ (PRef _ cons) args)
1347 | nsroot cons == sUN "::",
1369 | nsroot cons == sUN "::",
1348 (PExp {getTm=tl}):(PExp {getTm=hd}):imps <- reverse args,
1370 (PExp {getTm=tl}):(PExp {getTm=hd}):imps <- reverse args,
@@ -1355,16 +1377,16 @@ pprintPTerm impl bnd docArgs infixes = prettySe 10 bnd
1355 slist' _ _ tm = Nothing
1377 slist' _ _ tm = Nothing
1357 slist p bnd e | Just es <- slist' p bnd e = Just $
1379 slist p bnd e | Just es <- slist' p bnd e = Just $
1358− case es of [] -> annotate AnnConstData $ text "[]"
1380+ case es of [] -> annotate (AnnData "" "") $ text "[]"
1359 [x] -> enclose left right . group $
1381 [x] -> enclose left right . group $
1360 prettySe p bnd x
1382 prettySe p bnd x
1361 xs -> (enclose left right .
1383 xs -> (enclose left right .
1362 align . group . vsep .
1384 align . group . vsep .
1363 punctuate comma .
1385 punctuate comma .
1364 map (prettySe p bnd)) xs
1386 map (prettySe p bnd)) xs
1365− where left = (annotate AnnConstData (text "["))
1387+ where left = (annotate (AnnData "" "") (text "["))
1366− right = (annotate AnnConstData (text "]"))
1388+ right = (annotate (AnnData "" "") (text "]"))
1367− comma = (annotate AnnConstData (text ","))
1389+ comma = (annotate (AnnData "" "") (text ","))
1368 slist _ _ _ = Nothing
1390 slist _ _ _ = Nothing
1370 pairElts :: PTerm -> Maybe [PTerm]
1392 pairElts :: PTerm -> Maybe [PTerm]
@@ -1415,43 +1437,43 @@ prettyName showNS bnd n | Just imp <- lookup n bnd = annotate (AnnBoundName n im
1415 strName other = show other
1437 strName other = show other
1418−showCImp :: Bool -> PClause -> Doc OutputAnnotation
1440+showCImp :: PPOption -> PClause -> Doc OutputAnnotation
1419−showCImp impl (PClause _ n l ws r w)
1441+showCImp ppo (PClause _ n l ws r w)
1420− = prettyImp impl l <+> showWs ws <+> text "=" <+> prettyImp impl r
1442+ = prettyImp ppo l <+> showWs ws <+> text "=" <+> prettyImp ppo r
1421 <+> text "where" <+> text (show w)
1443 <+> text "where" <+> text (show w)
1423 showWs [] = empty
1445 showWs [] = empty
1424− showWs (x : xs) = text "|" <+> prettyImp impl x <+> showWs xs
1446+ showWs (x : xs) = text "|" <+> prettyImp ppo x <+> showWs xs
1425−showCImp impl (PWith _ n l ws r w)
1447+showCImp ppo (PWith _ n l ws r w)
1426− = prettyImp impl l <+> showWs ws <+> text "with" <+> prettyImp impl r
1448+ = prettyImp ppo l <+> showWs ws <+> text "with" <+> prettyImp ppo r
1427 <+> braces (text (show w))
1449 <+> braces (text (show w))
1429 showWs [] = empty
1451 showWs [] = empty
1430− showWs (x : xs) = text "|" <+> prettyImp impl x <+> showWs xs
1452+ showWs (x : xs) = text "|" <+> prettyImp ppo x <+> showWs xs
1433−showDImp :: Bool -> PData -> Doc OutputAnnotation
1455+showDImp :: PPOption -> PData -> Doc OutputAnnotation
1434−showDImp impl (PDatadecl n ty cons)
1456+showDImp ppo (PDatadecl n ty cons)
1435− = text "data" <+> text (show n) <+> colon <+> prettyImp impl ty <+> text "where" <$>
1457+ = text "data" <+> text (show n) <+> colon <+> prettyImp ppo ty <+> text "where" <$>
1436− (indent 2 $ vsep (map (\ (_, _, n, t, _, _) -> pipe <+> prettyName False [] n <+> colon <+> prettyImp impl t) cons))
1458+ (indent 2 $ vsep (map (\ (_, _, n, t, _, _) -> pipe <+> prettyName False [] n <+> colon <+> prettyImp ppo t) cons))
1438−showDecls :: Bool -> [PDecl] -> Doc OutputAnnotation
1460+showDecls :: PPOption -> [PDecl] -> Doc OutputAnnotation
1439−showDecls i ds = vsep (map (showDeclImp i) ds)
1461+showDecls o ds = vsep (map (showDeclImp o) ds)
1441showDeclImp _ (PFix _ f ops) = text (show f) <+> cat (punctuate (text ",") (map text ops))
1463showDeclImp _ (PFix _ f ops) = text (show f) <+> cat (punctuate (text ",") (map text ops))
1442−showDeclImp i (PTy _ _ _ _ _ n t) = text "tydecl" <+> text (showCG n) <+> colon <+> prettyImp i t
1464+showDeclImp o (PTy _ _ _ _ _ n t) = text "tydecl" <+> text (showCG n) <+> colon <+> prettyImp o t
1443−showDeclImp i (PClauses _ _ n cs) = text "pat" <+> text (showCG n) <+> text "\t" <+>
1465+showDeclImp o (PClauses _ _ n cs) = text "pat" <+> text (showCG n) <+> text "\t" <+>
1444− indent 2 (vsep (map (showCImp i) cs))
1466+ indent 2 (vsep (map (showCImp o) cs))
1445−showDeclImp _ (PData _ _ _ _ _ d) = showDImp True d
1467+showDeclImp o (PData _ _ _ _ _ d) = showDImp o { ppopt_impl = True } d
1446−showDeclImp i (PParams _ ns ps) = text "params" <+> braces (text (show ns) <> line <> showDecls i ps <> line)
1468+showDeclImp o (PParams _ ns ps) = text "params" <+> braces (text (show ns) <> line <> showDecls o ps <> line)
1447−showDeclImp i (PNamespace n ps) = text "namespace" <+> text n <> braces (line <> showDecls i ps <> line)
1469+showDeclImp o (PNamespace n ps) = text "namespace" <+> text n <> braces (line <> showDecls o ps <> line)
1448showDeclImp _ (PSyntax _ syn) = text "syntax" <+> text (show syn)
1470showDeclImp _ (PSyntax _ syn) = text "syntax" <+> text (show syn)
1449−showDeclImp i (PClass _ _ _ cs n ps _ ds)
1471+showDeclImp o (PClass _ _ _ cs n ps _ ds)
1450− = text "class" <+> text (show cs) <+> text (show n) <+> text (show ps) <> line <> showDecls i ds
1472+ = text "class" <+> text (show cs) <+> text (show n) <+> text (show ps) <> line <> showDecls o ds
1451−showDeclImp i (PInstance _ _ cs n _ t _ ds)
1473+showDeclImp o (PInstance _ _ cs n _ t _ ds)
1452− = text "instance" <+> text (show cs) <+> text (show n) <+> prettyImp i t <> line <> showDecls i ds
1474+ = text "instance" <+> text (show cs) <+> text (show n) <+> prettyImp o t <> line <> showDecls o ds
1453showDeclImp _ _ = text "..."
1475showDeclImp _ _ = text "..."
1454−-- showDeclImp (PImport i) = "import " ++ i
1476+-- showDeclImp (PImport o) = "import " ++ o
1456instance Show (Doc OutputAnnotation) where
1478instance Show (Doc OutputAnnotation) where
1457 show = flip (displayS . renderCompact) ""
1479 show = flip (displayS . renderCompact) ""
@@ -1478,14 +1500,14 @@ getAll = map getTm
1478-- | Show Idris name
1500-- | Show Idris name
1479showName :: Maybe IState -- ^^ the Idris state, for information about names and colours
1501showName :: Maybe IState -- ^^ the Idris state, for information about names and colours
1480 -> [(Name, Bool)] -- ^^ the bound variables and whether they're implicit
1502 -> [(Name, Bool)] -- ^^ the bound variables and whether they're implicit
1481− -> Bool -- ^^ whether to show implicits
1503+ -> PPOption -- ^^ pretty printing options
1482 -> Bool -- ^^ whether to colourise
1504 -> Bool -- ^^ whether to colourise
1483 -> Name -- ^^ the term to show
1505 -> Name -- ^^ the term to show
1484 -> String
1506 -> String
1485−showName ist bnd impl colour n = case ist of
1507+showName ist bnd ppo colour n = case ist of
1486 Just i -> if colour then colourise n (idris_colourTheme i) else showbasic n
1508 Just i -> if colour then colourise n (idris_colourTheme i) else showbasic n
1487 Nothing -> showbasic n
1509 Nothing -> showbasic n
1488− where name = if impl then show n else showbasic n
1510+ where name = if ppopt_impl ppo then show n else showbasic n
1489 showbasic n@(UN _) = showCG n
1511 showbasic n@(UN _) = showCG n
1490 showbasic (MN _ s) = str s
1512 showbasic (MN _ s) = str s
1491 showbasic (NS n s) = showSep "." (map str (reverse s)) ++ "." ++ showbasic n
1513 showbasic (NS n s) = showSep "." (map str (reverse s)) ++ "." ++ showbasic n
@@ -1509,11 +1531,12 @@ showTm :: IState -- ^^ the Idris state, for information about identifiers and co
1509 -> String
1531 -> String
1510showTm ist = displayDecorated (consoleDecorate ist) .
1532showTm ist = displayDecorated (consoleDecorate ist) .
1511 renderPretty 0.8 100000 .
1533 renderPretty 0.8 100000 .
1512− prettyImp (opt_showimp (idris_options ist))
1534+ prettyImp (ppOptionIst ist)
1514-- | Show a term with implicits, no colours
1536-- | Show a term with implicits, no colours
1515showTmImpls :: PTerm -> String
1537showTmImpls :: PTerm -> String
1516−showTmImpls = flip (displayS . renderCompact . prettyImp True) ""
1538+showTmImpls = flip (displayS . renderCompact . prettyImp verbosePPOption) ""
1519instance Sized PTerm where
1542instance Sized PTerm where