@@ -113,23 +113,28 @@ hasValidIBCVersion fp = do
113113 Right archive -> do ver <- getEntry 0 "ver" archive
114114 return (ver == ibcVersion)
115115
116+
116117loadIBC :: Bool -- ^ True = reexport, False = make everything private
117118 -> IBCPhase
118119 -> FilePath -> Idris ()
119120loadIBC reexport phase fp
120121 = do imps <- getImported
121− let redo = case lookup fp imps of
122− Nothing -> True
123− Just p -> not p && reexport
124− when redo $
125− do logIBC 1 $ "Loading ibc " ++ fp ++ " " ++ show reexport
126− archiveFile <- runIO $ B.readFile fp
127− case toArchiveOrFail archiveFile of
128− Left _ -> ifail $ fp ++ " isn't loadable, it may have an old ibc format.\n"
129− ++ "Please clean and rebuild it."
130− Right archive -> do process reexport phase archive fp
131− addImported reexport fp
132−-- dumpTT
122+ case lookup fp imps of
123+ Nothing -> load True
124+ Just p -> if (not p && reexport) then load False else return ()
125+ where
126+ load fullLoad = do
127+ logIBC 1 $ "Loading ibc " ++ fp ++ " " ++ show reexport
128+ archiveFile <- runIO $ B.readFile fp
129+ case toArchiveOrFail archiveFile of
130+ Left _ -> do
131+ ifail $ fp ++ " isn't loadable, it may have an old ibc format.\n"
132+ ++ "Please clean and rebuild it."
133+ Right archive -> do
134+ if fullLoad
135+ then process reexport phase archive fp
136+ else unhide phase archive
137+ addImported reexport fp
133138
134139-- | Load an entire package from its index file
135140loadPkgIndex :: String -> Idris ()
@@ -324,8 +329,13 @@ getEntry alt f a = case findEntryByPath f a of
324329 Nothing -> return alt
325330 Just e -> return $! (force . decode . fromEntry) e
326331
332+unhide :: IBCPhase -> Archive -> Idris ()
333+unhide phase ar = do
334+ pImports True phase =<< getEntry [] "ibc_imports" ar
335+ pAccess True phase =<< getEntry [] "ibc_access" ar
336+
327337process :: Bool -- ^ Reexporting
328− -> IBCPhase
338+ -> IBCPhase
329339 -> Archive -> FilePath -> Idris ()
330340process reexp phase i fn = do
331341 ver <- getEntry 0 "ver" i
@@ -616,7 +626,7 @@ pAccess reexp phase ds
616626 else logIBC 1 $ "Exporting " ++ show n
617627 -- Everything should be available at the REPL from
618628 -- things imported publicly
619− when (phase == IBC_REPL True) $
629+ when (phase == IBC_REPL True) $
620630 setAccessibility n Public
621631 ) ds
622632