Skip to content

Commit

Permalink
Use Pretty in D.S.T.PackagePath
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed May 11, 2020
1 parent 208162b commit 1d1d23e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cabal-install/Distribution/Solver/Types/PackagePath.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Distribution.Solver.Types.PackagePath
) where

import Distribution.Package
import Distribution.Deprecated.Text
import Distribution.Pretty (pretty, flatStyle)
import qualified Text.PrettyPrint as Disp
import Distribution.Solver.Compat.Prelude ((<<>>))

Expand All @@ -35,7 +35,7 @@ data Namespace =
-- ends in a period, so it can be prepended onto a qualifier.
dispNamespace :: Namespace -> Disp.Doc
dispNamespace DefaultNamespace = Disp.empty
dispNamespace (Independent i) = disp i <<>> Disp.text "."
dispNamespace (Independent i) = pretty i <<>> Disp.text "."

-- | Qualifier of a package within a namespace (see 'PackagePath')
data Qualifier =
Expand Down Expand Up @@ -79,10 +79,10 @@ data Qualifier =
-- 'Base' qualifier, will always be @base@).
dispQualifier :: Qualifier -> Disp.Doc
dispQualifier QualToplevel = Disp.empty
dispQualifier (QualSetup pn) = disp pn <<>> Disp.text ":setup."
dispQualifier (QualExe pn pn2) = disp pn <<>> Disp.text ":" <<>>
disp pn2 <<>> Disp.text ":exe."
dispQualifier (QualBase pn) = disp pn <<>> Disp.text "."
dispQualifier (QualSetup pn) = pretty pn <<>> Disp.text ":setup."
dispQualifier (QualExe pn pn2) = pretty pn <<>> Disp.text ":" <<>>
pretty pn2 <<>> Disp.text ":exe."
dispQualifier (QualBase pn) = pretty pn <<>> Disp.text "."

-- | A qualified entity. Pairs a package path with the entity.
data Qualified a = Q PackagePath a
Expand All @@ -94,7 +94,7 @@ type QPN = Qualified PackageName
-- | Pretty-prints a qualified package name.
dispQPN :: QPN -> Disp.Doc
dispQPN (Q (PackagePath ns qual) pn) =
dispNamespace ns <<>> dispQualifier qual <<>> disp pn
dispNamespace ns <<>> dispQualifier qual <<>> pretty pn

-- | String representation of a qualified package name.
showQPN :: QPN -> String
Expand Down

0 comments on commit 1d1d23e

Please sign in to comment.