extractPackages :: Index -> IO SourceRepository
extractPackages index = do
    putStrLn "Extracting Packages ..."
    packageList <- forM (Map.toList index) (\(packagename,versionnumbers) -> do
        versionList <- forM versionnumbers (\versionnumber -> do
            let directory =  packageDirectory packagename versionnumber
                targetDirectory = "data/packages/" ++ packagename
            exists <- doesDirectoryExist directory
            when (not exists) (do
                createDirectoryIfMissing True targetDirectory
                void (rawSystem "tar" [
                    "xzf",
                    archiveFilePath packagename versionnumber,
                    "-C",targetDirectory]))
            return (versionnumber,directory))
        return (packagename,(Map.fromList versionList)))
    return (Map.fromList packageList)
extractPackages :: Index -> IO SourceRepository
extractPackages index = do
    putStrLn "Extracting Packages ..."
    packageList <- forM (Map.toList index) (\(packagename,versionnumbers) -> do
        versionList <- forM versionnumbers (\versionnumber -> do
            let directory =  packageDirectory packagename versionnumber
                targetDirectory = "data/packages/" ++ packagename
            exists <- doesDirectoryExist directory
            when (not exists) (do
                createDirectoryIfMissing True targetDirectory
                void (rawSystem "tar" [
                    "xzf",
                    archiveFilePath packagename versionnumber,
                    "-C",targetDirectory]))
            return (versionnumber,directory))
        return (packagename,(Map.fromList versionList)))
    return (Map.fromList packageList)
extractPackages index = do
    putStrLn "Extracting Packages ..."
    packageList <- forM (Map.toList index) (\(packagename,versionnumbers) -> do
        versionList <- forM versionnumbers (\versionnumber -> do
            let directory =  packageDirectory packagename versionnumber
                targetDirectory = "data/packages/" ++ packagename
            exists <- doesDirectoryExist directory
            when (not exists) (do
                createDirectoryIfMissing True targetDirectory
                void (rawSystem "tar" [
                    "xzf",
                    archiveFilePath packagename versionnumber,
                    "-C",targetDirectory]))
            return (versionnumber,directory))
        return (packagename,(Map.fromList versionList)))
    return (Map.fromList packageList)