processImports :: Bool -> IBCPhase -> Archive -> Idris ()
processImports reexp phase ar = do
    fs <- getEntry [] "ibc_imports" ar
    mapM_ (\(re, f) -> do
        i <- getIState
        ibcsd <- valIBCSubDir i
        ids <- allImportDirs
        fp <- findImport ids ibcsd f
--                        if (f `elem` imported i)
--                         then logLvl 1 $ "Already read " ++ f
        putIState (i { imported = f : imported i })
        let phase' = case phase of
                         IBC_REPL _ -> IBC_REPL False
                         p -> p
        case fp of
            LIDR fn -> do
                logIBC 1 $ "Failed at " ++ fn
                ifail "Must be an ibc"
            IDR fn -> do
                logIBC 1 $ "Failed at " ++ fn
                ifail "Must be an ibc"
            IBC fn src -> loadIBC (reexp && re) phase' fn) fs
processImports :: Bool -> IBCPhase -> Archive -> Idris ()
processImports reexp phase ar = do
    fs <- getEntry [] "ibc_imports" ar
    mapM_ (\(re, f) -> do
        i <- getIState
        ibcsd <- valIBCSubDir i
        ids <- allImportDirs
        fp <- findImport ids ibcsd f
--                        if (f `elem` imported i)
--                         then logLvl 1 $ "Already read " ++ f
        putIState (i { imported = f : imported i })
        let phase' = case phase of
                         IBC_REPL _ -> IBC_REPL False
                         p -> p
        case fp of
            LIDR fn -> do
                logIBC 1 $ "Failed at " ++ fn
                ifail "Must be an ibc"
            IDR fn -> do
                logIBC 1 $ "Failed at " ++ fn
                ifail "Must be an ibc"
            IBC fn src -> loadIBC (reexp && re) phase' fn) fs
processImports reexp phase ar = do
    fs <- getEntry [] "ibc_imports" ar
    mapM_ (\(re, f) -> do
        i <- getIState
        ibcsd <- valIBCSubDir i
        ids <- allImportDirs
        fp <- findImport ids ibcsd f
--                        if (f `elem` imported i)
--                         then logLvl 1 $ "Already read " ++ f
        putIState (i { imported = f : imported i })
        let phase' = case phase of
                         IBC_REPL _ -> IBC_REPL False
                         p -> p
        case fp of
            LIDR fn -> do
                logIBC 1 $ "Failed at " ++ fn
                ifail "Must be an ibc"
            IDR fn -> do
                logIBC 1 $ "Failed at " ++ fn
                ifail "Must be an ibc"
            IBC fn src -> loadIBC (reexp && re) phase' fn) fs