From 9cb1c594fa944bdaba84de69e35118430b5590cf Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Wed, 7 Aug 2019 19:04:12 +0200 Subject: Break cycle between 'Package' and 'Unit' --- src/CabalHelper/Compiletime/Program/CabalInstall.hs | 4 +++- src/CabalHelper/Compiletime/Program/Stack.hs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/CabalHelper/Compiletime/Program') diff --git a/src/CabalHelper/Compiletime/Program/CabalInstall.hs b/src/CabalHelper/Compiletime/Program/CabalInstall.hs index cce4364..cc05421 100644 --- a/src/CabalHelper/Compiletime/Program/CabalInstall.hs +++ b/src/CabalHelper/Compiletime/Program/CabalInstall.hs @@ -262,6 +262,7 @@ planPackages plan = do where groupByMap = Map.fromListWith (<>) . map (CP.uPId &&& (:|[])) + mkPackage :: NonEmpty CP.Unit -> IO (Package ('Cabal 'CV2)) mkPackage units@(unit :| _) = case unit of CP.Unit @@ -275,11 +276,12 @@ planPackages plan = do , pSourceDir = pkgdir , pCabalFile = CabalFile cabal_file , pFlags = [] - , pUnits = fmap (mkUnit pkg) units + , pUnits = fmap (mkUnit pkg { pUnits = () }) units } return pkg _ -> panicIO "planPackages.mkPackage: Got non-unpacked package src!" + mkUnit :: Package' () -> CP.Unit -> Unit ('Cabal 'CV2) mkUnit pkg CP.Unit { uDistDir=Just distdirv1 , uComps=comps diff --git a/src/CabalHelper/Compiletime/Program/Stack.hs b/src/CabalHelper/Compiletime/Program/Stack.hs index 6f3365f..5c5f808 100644 --- a/src/CabalHelper/Compiletime/Program/Stack.hs +++ b/src/CabalHelper/Compiletime/Program/Stack.hs @@ -60,7 +60,7 @@ getPackage qe cabal_file@(CabalFile cabal_file_path) = do , pUnits = (:|[]) $ Unit { uUnitId = UnitId pkg_name , uDistDir = DistDirLib $ pkgdir distdirv1_rel - , uPackage = pkg + , uPackage = pkg { pUnits = () } , uImpl = UnitImplStack } } -- cgit v1.2.3