aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime/Types.hs
diff options
context:
space:
mode:
authorSebastian Wild <wildsebastian@users.noreply.github.com>2018-11-17 13:48:58 +0100
committerDaniel Gröber <dxld@darkboxed.org>2019-01-22 03:03:25 +0100
commit95f5dffb70a06d84a6c05b4df2e17b29bd93942a (patch)
treec53eb4c1be5a8c56e98e2ed22e21fcd79a283966 /src/CabalHelper/Compiletime/Types.hs
parentce1843e26aa439cacf5483cf9ea1e37e6b99b35e (diff)
Implement behaviour for cabal new-* (#61)
Add list of components to Unit data type to handle v2 based builds per cabal unit.
Diffstat (limited to 'src/CabalHelper/Compiletime/Types.hs')
-rw-r--r--src/CabalHelper/Compiletime/Types.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs
index cb2fbda..e432c6d 100644
--- a/src/CabalHelper/Compiletime/Types.hs
+++ b/src/CabalHelper/Compiletime/Types.hs
@@ -139,13 +139,24 @@ newtype DistDirLib = DistDirLib FilePath
--
-- As opposed to components, different 'Unit's can be queried independently
-- since their on-disk information is stored separately.
-data Unit = Unit
+data Unit pt = Unit
{ uUnitId :: !UnitId
, uPackageDir :: !FilePath
, uCabalFile :: !CabalFile
, uDistDir :: !DistDirLib
+ , uImpl :: !(UnitImpl pt)
}
+data UnitImpl pt where
+ UnitImplV1 :: UnitImpl 'V1
+
+ UnitImplV2 ::
+ { uiV2Components :: ![String]
+ } -> UnitImpl 'V2
+
+ UnitImplStack :: UnitImpl 'Stack
+
+
newtype UnitId = UnitId String
deriving (Eq, Ord, Read, Show)
@@ -206,7 +217,7 @@ newtype ProjConfModTimes = ProjConfModTimes [(FilePath, EpochTime)]
data ProjInfo pt = ProjInfo
{ piCabalVersion :: !Version
, piProjConfModTimes :: !ProjConfModTimes
- , piUnits :: ![Unit]
+ , piUnits :: ![Unit pt]
, piImpl :: !(ProjInfoImpl pt)
}
@@ -225,7 +236,7 @@ data ProjInfoImpl pt where
data UnitModTimes = UnitModTimes
{ umtCabalFile :: !(FilePath, EpochTime)
- , umtSetupConfig :: !(FilePath, EpochTime)
+ , umtSetupConfig :: !(Maybe (FilePath, EpochTime))
} deriving (Eq, Ord, Read, Show)
newtype CabalFile = CabalFile FilePath