X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Futils%2FPretty.lhs;h=9c94c8eb0cc926a5bf89e56520c369dc2981ded1;hb=e4cdbb7b821b1ee6dfb0d7a5ef7275edab6a0520;hp=51ecf31845229a67ee20c9b4e4e6e5c53f4b20f3;hpb=01ecefa4b97106fec5c139c5514e5d56e59ecbaf;p=ghc-hetmet.git diff --git a/compiler/utils/Pretty.lhs b/compiler/utils/Pretty.lhs index 51ecf31..9c94c8e 100644 --- a/compiler/utils/Pretty.lhs +++ b/compiler/utils/Pretty.lhs @@ -152,6 +152,13 @@ Relative to John's original paper, there are the following new features: \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module Pretty ( Doc, -- Abstract Mode(..), TextDetails(..), @@ -982,26 +989,29 @@ display mode IBOX(page_width) IBOX(ribbon_width) txt end doc other -> lay1 k s sl p - lay1 k s sl p = Str (indent k) `txt` (s `txt` lay2 (k PLUS sl) p) + lay1 k s sl p = indent k (s `txt` lay2 (k PLUS sl) p) lay2 k (NilAbove p) = nl_text `txt` lay k p lay2 k (TextBeside s sl p) = s `txt` (lay2 (k PLUS sl) p) lay2 k (Nest _ p) = lay2 k p lay2 k Empty = end + + -- optimise long indentations using LitString chunks of 8 spaces + indent n r | n GREQ ILIT(8) = LStr " "# 8# `txt` + indent (n MINUS ILIT(8)) r + | otherwise = Str (spaces n) `txt` r in lay ILIT(0) doc }} cant_fail = error "easy_display: NoDoc" -indent n | n GREQ ILIT(8) = '\t' : indent (n MINUS ILIT(8)) - | otherwise = spaces n - multi_ch n ch | n LTEQ ILIT(0) = "" | otherwise = ch : multi_ch (n MINUS ILIT(1)) ch spaces n | n LTEQ ILIT(0) = "" | otherwise = ' ' : spaces (n MINUS ILIT(1)) + \end{code} \begin{code}