summaryrefslogtreecommitdiff
path: root/Portage/Dependency/Print.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Portage/Dependency/Print.hs')
-rw-r--r--Portage/Dependency/Print.hs37
1 files changed, 20 insertions, 17 deletions
diff --git a/Portage/Dependency/Print.hs b/Portage/Dependency/Print.hs
index 9c9ed02..2c941aa 100644
--- a/Portage/Dependency/Print.hs
+++ b/Portage/Dependency/Print.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
module Portage.Dependency.Print
(
dep2str
@@ -11,7 +13,8 @@ import Portage.PackageId
import qualified Distribution.Text as DT
import qualified Text.PrettyPrint as Disp
-import Text.PrettyPrint ( (<>), vcat, nest, render )
+import Text.PrettyPrint ( vcat, nest, render )
+import Text.PrettyPrint as PP ((<>))
import Portage.Dependency.Types
@@ -21,17 +24,17 @@ dispSlot AnyBuildTimeSlot = Disp.text ":="
dispSlot (GivenSlot slot) = Disp.text (':' : slot)
dispLBound :: PackageName -> LBound -> Disp.Doc
-dispLBound pn (StrictLB v) = Disp.char '>' <> DT.disp pn <-> DT.disp v
-dispLBound pn (NonstrictLB v) = Disp.text ">=" <> DT.disp pn <-> DT.disp v
+dispLBound pn (StrictLB v) = Disp.char '>' PP.<> DT.disp pn <-> DT.disp v
+dispLBound pn (NonstrictLB v) = Disp.text ">=" PP.<> DT.disp pn <-> DT.disp v
dispLBound _pn ZeroB = error "unhandled 'dispLBound ZeroB'"
dispUBound :: PackageName -> UBound -> Disp.Doc
-dispUBound pn (StrictUB v) = Disp.char '<' <> DT.disp pn <-> DT.disp v
-dispUBound pn (NonstrictUB v) = Disp.text "<=" <> DT.disp pn <-> DT.disp v
+dispUBound pn (StrictUB v) = Disp.char '<' PP.<> DT.disp pn <-> DT.disp v
+dispUBound pn (NonstrictUB v) = Disp.text "<=" PP.<> DT.disp pn <-> DT.disp v
dispUBound _pn InfinityB = error "unhandled 'dispUBound Infinity'"
dispDAttr :: DAttr -> Disp.Doc
-dispDAttr (DAttr s u) = dispSlot s <> dispUses u
+dispDAttr (DAttr s u) = dispSlot s PP.<> dispUses u
dep2str :: Int -> Dependency -> String
dep2str start_indent = render . nest start_indent . showDepend
@@ -40,13 +43,13 @@ dep2str_noindent :: Dependency -> String
dep2str_noindent = render . showDepend
(<->) :: Disp.Doc -> Disp.Doc -> Disp.Doc
-a <-> b = a <> Disp.char '-' <> b
+a <-> b = a PP.<> Disp.char '-' PP.<> b
sp :: Disp.Doc
sp = Disp.char ' '
sparens :: Disp.Doc -> Disp.Doc
-sparens doc = Disp.parens (sp <> valign doc <> sp)
+sparens doc = Disp.parens (sp PP.<> valign doc PP.<> sp)
valign :: Disp.Doc -> Disp.Doc
valign d = nest 0 d
@@ -55,24 +58,24 @@ showDepend :: Dependency -> Disp.Doc
showDepend (DependAtom (Atom pn range dattr))
= case range of
-- any version
- DRange ZeroB InfinityB -> DT.disp pn <> dispDAttr dattr
- DRange ZeroB ub -> dispUBound pn ub <> dispDAttr dattr
- DRange lb InfinityB -> dispLBound pn lb <> dispDAttr dattr
+ DRange ZeroB InfinityB -> DT.disp pn PP.<> dispDAttr dattr
+ DRange ZeroB ub -> dispUBound pn ub PP.<> dispDAttr dattr
+ DRange lb InfinityB -> dispLBound pn lb PP.<> dispDAttr dattr
-- TODO: handle >=foo-0 special case
-- TODO: handle =foo-x.y.* special case
DRange lb ub -> showDepend (DependAtom (Atom pn (DRange lb InfinityB) dattr))
- <> Disp.char ' '
- <> showDepend (DependAtom (Atom pn (DRange ZeroB ub) dattr))
- DExact v -> Disp.char '~' <> DT.disp pn <-> DT.disp v { versionRevision = 0 } <> dispDAttr dattr
+ PP.<> Disp.char ' '
+ PP.<> showDepend (DependAtom (Atom pn (DRange ZeroB ub) dattr))
+ DExact v -> Disp.char '~' PP.<> DT.disp pn <-> DT.disp v { versionRevision = 0 } PP.<> dispDAttr dattr
showDepend (DependIfUse u td fd) = valign $ vcat [td_doc, fd_doc]
where td_doc
| is_empty_dependency td = Disp.empty
- | otherwise = DT.disp u <> Disp.char '?' <> sp <> sparens (showDepend td)
+ | otherwise = DT.disp u PP.<> Disp.char '?' PP.<> sp PP.<> sparens (showDepend td)
fd_doc
| is_empty_dependency fd = Disp.empty
- | otherwise = Disp.char '!' <> DT.disp u <> Disp.char '?' <> sp <> sparens (showDepend fd)
-showDepend (DependAnyOf deps) = Disp.text "||" <> sp <> sparens (vcat $ map showDependInAnyOf deps)
+ | otherwise = Disp.char '!' PP.<> DT.disp u PP.<> Disp.char '?' PP.<> sp PP.<> sparens (showDepend fd)
+showDepend (DependAnyOf deps) = Disp.text "||" PP.<> sp PP.<> sparens (vcat $ map showDependInAnyOf deps)
showDepend (DependAllOf deps) = valign $ vcat $ map showDepend deps
-- needs special grouping