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 = forall id. AnnotatedId id -> id
ann_id forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall id. AnnotatedId id -> PackageId
ann_pid forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall id. AnnotatedId id -> ComponentName
ann_cname forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall id rn. ComponentInclude id rn -> AnnotatedId id
ci_ann_id