    module Distribution.Types.MissingDependency
      ( MissingDependency (..)
      ) where

    import Distribution.Compat.Prelude
    import Distribution.Pretty
    import Distribution.Types.Dependency
      ( Dependency
      , simplifyDependency
      )
    import Distribution.Types.LibraryName
      ( prettyLibraryNames
      )
    import Distribution.Types.MissingDependencyReason
      ( MissingDependencyReason (..)
      )

    import qualified Text.PrettyPrint as PP

    -- | A missing dependency and information on why it's missing.
    data MissingDependency = MissingDependency Dependency MissingDependencyReason
      deriving (Int -> MissingDependency -> ShowS
    [MissingDependency] -> ShowS
    MissingDependency -> String
    (Int -> MissingDependency -> ShowS)
    -> (MissingDependency -> String)
    -> ([MissingDependency] -> ShowS)
    -> Show MissingDependency
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MissingDependency -> ShowS
    showsPrec :: Int -> MissingDependency -> ShowS
    $cshow :: MissingDependency -> String
    show :: MissingDependency -> String
    $cshowList :: [MissingDependency] -> ShowS
    showList :: [MissingDependency] -> ShowS
    Show)

    instance Pretty MissingDependency where
      pretty :: MissingDependency -> Doc
    pretty (MissingDependency Dependency
    dependency MissingDependencyReason
    reason) =
        let prettyReason :: Doc
    prettyReason =
              case MissingDependencyReason
    reason of
                MissingLibrary NonEmpty LibraryName
    libraries ->
                  String -> Doc
    PP.text String
    "missing" Doc -> Doc -> Doc
    <+> Doc -> NonEmpty LibraryName -> Doc
    forall a. Pretty a => a -> NonEmpty LibraryName -> Doc
    prettyLibraryNames Doc
    PP.empty NonEmpty LibraryName
    libraries
                MissingDependencyReason
    MissingPackage -> String -> Doc
    PP.text String
    "missing"
                MissingComponent PackageName
    name -> String -> Doc
    PP.text String
    "missing component" Doc -> Doc -> Doc
    <+> PackageName -> Doc
    forall a. Pretty a => a -> Doc
    pretty PackageName
    name
                WrongVersion [Version]
    versions ->
                  String -> Doc
    PP.text String
    "installed:" Doc -> Doc -> Doc
    <+> [Version] -> Doc
    forall a. Pretty a => [a] -> Doc
    commaSpaceSep [Version]
    versions
         in Dependency -> Doc
    forall a. Pretty a => a -> Doc
    pretty (Dependency -> Dependency
    simplifyDependency Dependency
    dependency) Doc -> Doc -> Doc
    <+> Doc -> Doc
    PP.parens Doc
    prettyReason