unqualifyDeps :: FlaggedDeps comp QPN -> FlaggedDeps comp PN
unqualifyDeps = go
  where
    go :: FlaggedDeps comp QPN -> FlaggedDeps comp PN
    go = map go1

    go1 :: FlaggedDep comp QPN -> FlaggedDep comp PN
    go1 (Flagged fn nfo t f) = Flagged (fmap unq fn) nfo (go t) (go f)
    go1 (Stanza  sn     t)   = Stanza  (fmap unq sn)     (go t)
    go1 (Simple dep comp)    = Simple (goD dep) comp

    goD :: Dep QPN -> Dep PN
    goD (Dep is_exe qpn ci) = Dep is_exe (unq qpn) (fmap unq ci)
    goD (Ext  ext)   = Ext ext
    goD (Lang lang)  = Lang lang
    goD (Pkg pn vr)  = Pkg pn vr

    unq :: QPN -> PN
    unq (Q _ pn) = pn

{-------------------------------------------------------------------------------
  Setting/forgetting the Component
-------------------------------------------------------------------------------}
unqualifyDeps :: FlaggedDeps comp QPN -> FlaggedDeps comp PN
unqualifyDeps = go
  where
    go :: FlaggedDeps comp QPN -> FlaggedDeps comp PN
    go = map go1

    go1 :: FlaggedDep comp QPN -> FlaggedDep comp PN
    go1 (Flagged fn nfo t f) = Flagged (fmap unq fn) nfo (go t) (go f)
    go1 (Stanza  sn     t)   = Stanza  (fmap unq sn)     (go t)
    go1 (Simple dep comp)    = Simple (goD dep) comp

    goD :: Dep QPN -> Dep PN
    goD (Dep is_exe qpn ci) = Dep is_exe (unq qpn) (fmap unq ci)
    goD (Ext  ext)   = Ext ext
    goD (Lang lang)  = Lang lang
    goD (Pkg pn vr)  = Pkg pn vr

    unq :: QPN -> PN
    unq (Q _ pn) = pn

{-------------------------------------------------------------------------------
  Setting/forgetting the Component
-------------------------------------------------------------------------------}
unqualifyDeps = go
  where
    go :: FlaggedDeps comp QPN -> FlaggedDeps comp PN
    go = map go1

    go1 :: FlaggedDep comp QPN -> FlaggedDep comp PN
    go1 (Flagged fn nfo t f) = Flagged (fmap unq fn) nfo (go t) (go f)
    go1 (Stanza  sn     t)   = Stanza  (fmap unq sn)     (go t)
    go1 (Simple dep comp)    = Simple (goD dep) comp

    goD :: Dep QPN -> Dep PN
    goD (Dep is_exe qpn ci) = Dep is_exe (unq qpn) (fmap unq ci)
    goD (Ext  ext)   = Ext ext
    goD (Lang lang)  = Lang lang
    goD (Pkg pn vr)  = Pkg pn vr

    unq :: QPN -> PN
    unq (Q _ pn) = pn

{-------------------------------------------------------------------------------
  Setting/forgetting the Component
-------------------------------------------------------------------------------}