toEditor :: PackageDescription -> PackageDescriptionEd
toEditor pd =
    let     (exes,exeBis) = unzip $ map (\((Executable s fb bi), i) -> ((Executable' (T.pack s) fb i), bi))
                            (zip (executables pd) [0..])
            (tests,testBis) = unzip $ map (\((TestSuite s fb bi _), i) -> ((Test' (T.pack s) fb i), bi))
                            (zip (testSuites pd) [length exeBis..])
            (bms,benchmarkBis) = unzip $ map (\((Benchmark s fb bi _), i) -> ((Benchmark' (T.pack s) fb i), bi))
                            (zip (benchmarks pd) [length testBis..])
            bis = exeBis ++ testBis ++ benchmarkBis
            (mbLib,bis2) = case library pd of
                    Nothing                -> (Nothing,bis)
#if MIN_VERSION_Cabal(1,22,0)
                    Just (Library mn rmn rs es b bi) -> (Just (Library' (sort mn) rmn rs es b (length bis)), bis ++ [bi])
#else
                    Just (Library mn b bi) -> (Just (Library' (sort mn) b (length bis)), bis ++ [bi])
#endif
            bis3 = if null bis2
                        then [emptyBuildInfo]
                        else bis2
    in PDE (pd {library = Nothing , executables = []})
        exes
        tests
        bms
        mbLib
        bis3
toEditor :: PackageDescription -> PackageDescriptionEd
toEditor pd =
    let     (exes,exeBis) = unzip $ map (\((Executable s fb bi), i) -> ((Executable' (T.pack s) fb i), bi))
                            (zip (executables pd) [0..])
            (tests,testBis) = unzip $ map (\((TestSuite s fb bi _), i) -> ((Test' (T.pack s) fb i), bi))
                            (zip (testSuites pd) [length exeBis..])
            (bms,benchmarkBis) = unzip $ map (\((Benchmark s fb bi _), i) -> ((Benchmark' (T.pack s) fb i), bi))
                            (zip (benchmarks pd) [length testBis..])
            bis = exeBis ++ testBis ++ benchmarkBis
            (mbLib,bis2) = case library pd of
                    Nothing                -> (Nothing,bis)
#if MIN_VERSION_Cabal(1,22,0)
                    Just (Library mn rmn rs es b bi) -> (Just (Library' (sort mn) rmn rs es b (length bis)), bis ++ [bi])
#else
                    Just (Library mn b bi) -> (Just (Library' (sort mn) b (length bis)), bis ++ [bi])
#endif
            bis3 = if null bis2
                        then [emptyBuildInfo]
                        else bis2
    in PDE (pd {library = Nothing , executables = []})
        exes
        tests
        bms
        mbLib
        bis3
toEditor pd =
    let     (exes,exeBis) = unzip $ map (\((Executable s fb bi), i) -> ((Executable' (T.pack s) fb i), bi))
                            (zip (executables pd) [0..])
            (tests,testBis) = unzip $ map (\((TestSuite s fb bi _), i) -> ((Test' (T.pack s) fb i), bi))
                            (zip (testSuites pd) [length exeBis..])
            (bms,benchmarkBis) = unzip $ map (\((Benchmark s fb bi _), i) -> ((Benchmark' (T.pack s) fb i), bi))
                            (zip (benchmarks pd) [length testBis..])
            bis = exeBis ++ testBis ++ benchmarkBis
            (mbLib,bis2) = case library pd of
                    Nothing                -> (Nothing,bis)
#if MIN_VERSION_Cabal(1,22,0)
                    Just (Library mn rmn rs es b bi) -> (Just (Library' (sort mn) rmn rs es b (length bis)), bis ++ [bi])
#else
                    Just (Library mn b bi) -> (Just (Library' (sort mn) b (length bis)), bis ++ [bi])
#endif
            bis3 = if null bis2
                        then [emptyBuildInfo]
                        else bis2
    in PDE (pd {library = Nothing , executables = []})
        exes
        tests
        bms
        mbLib
        bis3