@@ -69,49 +69,62 @@ showDoc ist d
69 renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) d
69 renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) d
71pprintFD :: IState -> Bool -> Bool -> FunDoc -> Doc OutputAnnotation
71pprintFD :: IState -> Bool -> Bool -> FunDoc -> Doc OutputAnnotation
72−pprintFD ist totalityFlag nsFlag (FD n doc args ty f)
72+pprintFD ist totalityFlag nsFlag (FD n doc args ty f) =
73− = nest 4 (prettyName True nsFlag [] n <+> colon <+>
73+ nest 4 (prettyName True nsFlag [] n
74− pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
75+ <+> pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
75− , not (T.isPrefixOf (T.pack "__") n') ] infixes ty <$>
76+ , not (T.isPrefixOf (T.pack "__") n') ] infixes ty
76− -- show doc
77+ -- show doc
77− renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) doc <$>
78+ <$> renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) doc
78− -- show fixity
79+ -- show fixity
79− maybe empty (\f -> text (show f) <> line) f <>
80+ <$> maybe empty (\f -> text (show f) <> line) f
80− -- show arguments doc
81+ -- show arguments doc
81− let argshow = showArgs args [] in
82+ <> let argshow = showArgs args [] in
82− (if not (null argshow)
83+ (if not (null argshow)
83− then nest 4 $ text "Arguments:" <$> vsep argshow
84+ then nest 4 $ text "Arguments:" <$> vsep argshow
84− else empty) <>
85+ else empty)
85− -- show totality status
86+ -- show totality status
86− let totality = getTotality in
87+ <> let totality = getTotality in
87− (if totalityFlag && not (null totality) then
88+ (if totalityFlag && not (null totality)
88− line <> (vsep . map (\t -> text "The function is" <+> t) $ totality)
89+ then line <> (vsep . map (\t -> text "The function is" <+> t) $ totality)
90− empty))
90+ else empty))
92− where ppo = ppOptionIst ist
93+ ppo = ppOptionIst ist
93− infixes = idris_infixes ist
95+ infixes = idris_infixes ist
97+ -- Recurse over and show the Function's Documented arguments
94− showArgs ((n, ty, Exp {}, Just d):args) bnd
98+ showArgs ((n, ty, Exp {}, Just d):args) bnd = -- Explicitly bound.
95− = bindingOf n False <+> colon <+>
99+ bindingOf n False
96− pprintPTerm ppo bnd [] infixes ty <>
101+ <+> pprintPTerm ppo bnd [] infixes ty
97− showDoc ist d <> line
102+ <> showDoc ist d
99− showArgs args ((n, False):bnd)
103+ <> line : showArgs args ((n, False):bnd)
100− showArgs ((n, ty, Constraint {}, Just d):args) bnd
104+ showArgs ((n, ty, Constraint {}, Just d):args) bnd = -- Class constraints.
101− = text "Class constraint" <+>
105+ text "Class constraint"
102− pprintPTerm ppo bnd [] infixes ty <> showDoc ist d <> line
106+ <+> pprintPTerm ppo bnd [] infixes ty
103− :
107+ <> showDoc ist d
104− showArgs args ((n, True):bnd)
108+ <> line : showArgs args ((n, True):bnd)
105− showArgs ((n, ty, Imp {}, Just d):args) bnd
109+ showArgs ((n, ty, Imp {}, Just d):args) bnd = -- Implicit arguments.
106− = text "(implicit)" <+>
110+ text "(implicit)"
107− bindingOf n True <+> colon <+>
111+ <+> bindingOf n True
113+ <+> pprintPTerm ppo bnd [] infixes ty
115+ <> line : showArgs args ((n, True):bnd)
116+ showArgs ((n, ty, TacImp{}, Just d):args) bnd = -- Tacit implicits
117+ text "(auto implicit)"
118+ <+> bindingOf n True
108− pprintPTerm ppo bnd [] infixes ty <>
120+ <+> pprintPTerm ppo bnd [] infixes ty
109− showDoc ist d <> line
121+ <> showDoc ist d
111− showArgs args ((n, True):bnd)
122+ <> line : showArgs args ((n, True):bnd)
123+ showArgs ((n, _, _, _):args) bnd = -- Anything else
112− showArgs ((n, _, _, _):args) bnd = showArgs args ((n, True):bnd)
124+ showArgs args ((n, True):bnd)
113− showArgs [] _ = []
125+ showArgs [] _ = [] -- end of arguments
114− getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist)
127+ getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist)
116pprintFDWithTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
129pprintFDWithTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
117pprintFDWithTotality ist = pprintFD ist True
130pprintFDWithTotality ist = pprintFD ist True