    {-# LANGUAGE DeriveGeneric #-}
    module Distribution.Backpack.FullUnitId (
        FullUnitId(..),
        FullDb,
        expandOpenUnitId,
        expandUnitId
    ) where

    import Distribution.Backpack
    import Distribution.Types.ComponentId
    import Distribution.Compat.Prelude

    -- Unlike OpenUnitId, which could direct to a UnitId.
    data FullUnitId = FullUnitId ComponentId OpenModuleSubst
        deriving (Int -> FullUnitId -> ShowS
    [FullUnitId] -> ShowS
    FullUnitId -> String
    (Int -> FullUnitId -> ShowS)
    -> (FullUnitId -> String)
    -> ([FullUnitId] -> ShowS)
    -> Show FullUnitId
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> FullUnitId -> ShowS
    showsPrec :: Int -> FullUnitId -> ShowS
    $cshow :: FullUnitId -> String
    show :: FullUnitId -> String
    $cshowList :: [FullUnitId] -> ShowS
    showList :: [FullUnitId] -> ShowS
    Show, (forall x. FullUnitId -> Rep FullUnitId x)
    -> (forall x. Rep FullUnitId x -> FullUnitId) -> Generic FullUnitId
    forall x. Rep FullUnitId x -> FullUnitId
    forall x. FullUnitId -> Rep FullUnitId x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. FullUnitId -> Rep FullUnitId x
    from :: forall x. FullUnitId -> Rep FullUnitId x
    $cto :: forall x. Rep FullUnitId x -> FullUnitId
    to :: forall x. Rep FullUnitId x -> FullUnitId
    Generic)

    type FullDb = DefUnitId -> FullUnitId

    expandOpenUnitId :: FullDb -> OpenUnitId -> FullUnitId
    expandOpenUnitId :: FullDb -> OpenUnitId -> FullUnitId
    expandOpenUnitId FullDb
    _db (IndefFullUnitId ComponentId
    cid OpenModuleSubst
    subst)
        = ComponentId -> OpenModuleSubst -> FullUnitId
    FullUnitId ComponentId
    cid OpenModuleSubst
    subst
    expandOpenUnitId FullDb
    db (DefiniteUnitId DefUnitId
    uid)
        = FullDb -> FullDb
    expandUnitId FullDb
    db DefUnitId
    uid

    expandUnitId :: FullDb -> DefUnitId -> FullUnitId
    expandUnitId :: FullDb -> FullDb
    expandUnitId FullDb
    db DefUnitId
    uid = FullDb
    db DefUnitId
    uid