on master help sign in
clarify failing searches
commit5f0dbd780ed47ee71c9abc8adf72d292f2940194 authorJP Smith <jp.smith@ilstu.edu> dateThu 2 Apr 2015, 11:51 (12 years ago) parent4359edd
3 files changed+13−7
CONTRIBUTORS+1 src/Idris/REPL.hs+5−4 src/Idris/TypeSearch.hs+7−3
CONTRIBUTORS+1
@@ -32,6 +32,7 @@ Adam Sandberg Eriksson
3232Seo Sanghyeon
3333Benjamin Saunders
3434Alexander Shabalin
35+JP Smith
3536startling
3637Chetan T
3738Matúš Tejiščák
src/Idris/REPL.hs+5−4
@@ -1232,10 +1232,11 @@ process fn (Apropos pkgs a) =
12321232 delabTy ist n,
12331233 fmap (overview . fst) (lookupCtxtExact n (idris_docstrings ist)))
12341234 | n <- sort names, isUN n ]
1235− iRenderResult $ vsep (map (\(m, d) -> text "Module" <+> text m <$>
1236− ppD ist d <> line) mods) <$>
1237− vsep (map (prettyDocumentedIst ist) aproposInfo)
1238− putIState orig
1235+ if (not (null mods)) || (not (null aproposInfo))
1236+ then iRenderResult $ vsep (map (\(m, d) -> text "Module" <+> text m <$>
1237+ ppD ist d <> line) mods) <$>
1238+ vsep (map (prettyDocumentedIst ist) aproposInfo)
1239+ else iRenderError $ text "No results found"
12391240 where isUN (UN _) = True
12401241 isUN (NS n _) = isUN n
12411242 isUN _ = False
src/Idris/TypeSearch.hs+7−3
@@ -30,7 +30,7 @@ import Idris.Core.Unify (match_unify)
3030import Idris.Delaborate (delabTy)
3131import Idris.Docstrings (noDocs, overview)
3232import Idris.Elab.Type (elabType)
33−import Idris.Output (iputStrLn, iRenderOutput, iPrintResult, iRenderResult, prettyDocumentedIst)
33+import Idris.Output (iputStrLn, iRenderOutput, iPrintResult, iRenderError, iRenderResult, prettyDocumentedIst)
3434import Idris.IBC
3535
3636import Prelude hiding (pred)
@@ -55,9 +55,13 @@ searchByType pkgs pterm = do
5555 displayScore theScore <> char ' ' <> prettyDocumentedIst i docInfo
5656 | (n, theScore) <- names']
5757 case idris_outputmode i of
58− RawOutput _ -> do mapM_ iRenderOutput docs
58+ RawOutput _ -> do if (not (null docs))
59+ then mapM_ iRenderOutput docs
60+ else iRenderError $ text "No results found"
5961 iPrintResult ""
60− IdeMode _ _ -> iRenderResult (vsep docs)
62+ IdeMode _ _ -> if (not (null docs))
63+ then iRenderResult (vsep docs)
64+ else iRenderError $ text "No results found"
6165 putIState i -- don't actually make any changes
6266 where
6367 numLimit = 50