module Distribution.Types.ComponentInclude (
    ComponentInclude(..),
    ci_id,
    ci_pkgid,
    ci_cname
) where

import Distribution.Types.PackageId
import Distribution.Types.ComponentName
import Distribution.Types.AnnotatedId

-- Once ci_id is refined to an 'OpenUnitId' or 'DefUnitId',
-- the 'includeRequiresRn' is not so useful (because it
-- includes the requirements renaming that is no longer
-- needed); use 'ci_prov_renaming' instead.
data ComponentInclude id rn = ComponentInclude {
        forall id rn. ComponentInclude id rn -> AnnotatedId id
ci_ann_id   :: AnnotatedId id,
        forall id rn. ComponentInclude id rn -> rn
ci_renaming :: rn,
        -- | Did this come from an entry in @mixins@, or
        -- was implicitly generated by @build-depends@?
        forall id rn. ComponentInclude id rn -> Bool
ci_implicit :: Bool
    }

ci_id :: ComponentInclude id rn -> id
ci_id :: forall id rn. ComponentInclude id rn -> id
ci_id = AnnotatedId id -> id
forall id. AnnotatedId id -> id
ann_id (AnnotatedId id -> id)
-> (ComponentInclude id rn -> AnnotatedId id)
-> ComponentInclude id rn
-> id
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComponentInclude id rn -> AnnotatedId id
forall id rn. ComponentInclude id rn -> AnnotatedId id
ci_ann_id

ci_pkgid :: ComponentInclude id rn -> PackageId
ci_pkgid :: forall id rn. ComponentInclude id rn -> PackageId
ci_pkgid = AnnotatedId id -> PackageId
forall id. AnnotatedId id -> PackageId
ann_pid (AnnotatedId id -> PackageId)
-> (ComponentInclude id rn -> AnnotatedId id)
-> ComponentInclude id rn
-> PackageId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComponentInclude id rn -> AnnotatedId id
forall id rn. ComponentInclude id rn -> AnnotatedId id
ci_ann_id

-- | This should always return 'CLibName' or 'CSubLibName'
ci_cname :: ComponentInclude id rn -> ComponentName
ci_cname :: forall id rn. ComponentInclude id rn -> ComponentName
ci_cname = AnnotatedId id -> ComponentName
forall id. AnnotatedId id -> ComponentName
ann_cname (AnnotatedId id -> ComponentName)
-> (ComponentInclude id rn -> AnnotatedId id)
-> ComponentInclude id rn
-> ComponentName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComponentInclude id rn -> AnnotatedId id
forall id rn. ComponentInclude id rn -> AnnotatedId id
ci_ann_id