@@ -2,11 +2,13 @@
22
33module Idris.REPL.Browse (namespacesInNS, namesInNS) where
44
5+import Control.Monad (filterM)
6+
57import Data.List (isSuffixOf, nub)
68import Data.Maybe (mapMaybe)
79import qualified Data.Text as T (unpack)
810
9−import Idris.Core.Evaluate (ctxtAlist)
11+import Idris.Core.Evaluate (ctxtAlist, Accessibility(Hidden), lookupDefAccExact)
1012import Idris.Core.TT (Name(..))
1113
1214import Idris.AbsSyntaxTree (Idris)
@@ -31,7 +33,12 @@ namespacesInNS ns = do let revNS = reverse ns
3133namesInNS :: [String] -> Idris [Name]
3234namesInNS ns = do let revNS = reverse ns
3335 allNames <- fmap ctxtAlist getContext
34− return [ n | (n, space) <- mapMaybe (getNS . fst) allNames
35− , revNS == space ]
36+ let namesInSpace = [ n | (n, space) <- mapMaybe (getNS . fst) allNames
37+ , revNS == space ]
38+ filterM accessible namesInSpace
3639 where getNS n@(NS (UN n') namespace) = Just (n, (map T.unpack namespace))
3740 getNS _ = Nothing
41+ accessible n = do ctxt <- getContext
42+ case lookupDefAccExact n False ctxt of
43+ Just (_, Hidden ) -> return False
44+ _ -> return True