diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2018-12-16 01:04:38 +0100 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-01-22 03:06:51 +0100 |
commit | 30591c394974aa282891e37a6cff2802b4f92773 (patch) | |
tree | a367cea43c62f399618fba8c0fadfe2bc4d3e5d5 /src/CabalHelper/Compiletime/Types.hs | |
parent | 571448ca604065a6e6bfe7e6423b8ae6789b4dd9 (diff) |
Add 'uComponentName' query
Diffstat (limited to 'src/CabalHelper/Compiletime/Types.hs')
-rw-r--r-- | src/CabalHelper/Compiletime/Types.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs index 491c205..3c6ff73 100644 --- a/src/CabalHelper/Compiletime/Types.hs +++ b/src/CabalHelper/Compiletime/Types.hs @@ -154,11 +154,25 @@ data UnitImpl pt where UnitImplV1 :: UnitImpl 'V1 UnitImplV2 :: - { uiV2Components :: ![String] + { uiV2ComponentNames :: ![ChComponentName] + , uiV2Components :: ![String] } -> UnitImpl 'V2 UnitImplStack :: UnitImpl 'Stack +-- | This returns the component a 'Unit' corresponds to. This information is +-- only available if the correspondence happens to be unique and known before +-- querying setup-config for the respective project type. Currently this only +-- applies to @pt=@'V2'. +-- +-- This is intended to be used as an optimization, to allow reducing the number +-- of helper invocations for clients that don't need to know the entire project +-- structure. +uComponentName :: Unit pt -> Maybe ChComponentName +uComponentName Unit { uImpl=UnitImplV2 { uiV2ComponentNames=[comp] } } = + Just comp +uComponentName _ = + Nothing newtype UnitId = UnitId String deriving (Eq, Ord, Read, Show) |