module GHC.Unit.Ppr
( UnitPprInfo (..)
)
where
import GHC.Prelude
import GHC.Data.FastString
import GHC.Utils.Outputable
import Data.Version
data UnitPprInfo = UnitPprInfo
{ unitPprId :: FastString
, unitPprPackageName :: String
, unitPprPackageVersion :: Version
, unitPprComponentName :: Maybe String
}
instance Outputable UnitPprInfo where
ppr pprinfo = getPprDebug $ \debug ->
if debug
then ftext (unitPprId pprinfo)
else text $ mconcat
[ unitPprPackageName pprinfo
, case unitPprPackageVersion pprinfo of
Version [] [] -> ""
version -> "-" ++ showVersion version
, case unitPprComponentName pprinfo of
Nothing -> ""
Just cname -> ":" ++ cname
]