hang, punctuate,
-- renderStyle, -- Haskell 1.3 only
- render, fullRender
+ render, fullRender, printDoc
) where
#include "HsVersions.h"
import FastString
import GlaExts
import Numeric (fromRat)
+import IO
-- Don't import Util( assertPanic ) because it makes a loop in the module structure
#if defined(__GLASGOW_HASKELL__)
-
-- Glasgow Haskell
-- Disable ASSERT checks; they are expensive!
#define LOCAL_ASSERT(x)
+#define ILIT(x) (x#)
+#define IBOX(x) (I# (x))
#define INT Int#
#define MINUS -#
#define NEGATE negateInt#
spaces ILIT(0) = ""
spaces n = ' ' : spaces (n MINUS ILIT(1))
\end{code}
+
+\begin{code}
+pprCols = (100 :: Int) -- could make configurable
+
+printDoc :: Mode -> Handle -> Doc -> IO ()
+printDoc mode hdl doc
+ = fullRender mode pprCols 1.5 put done doc
+ where
+ put (Chr c) next = hPutChar hdl c >> next
+ put (Str s) next = hPutStr hdl s >> next
+ put (PStr s) next = hPutFS hdl s >> next
+
+ done = hPutChar hdl '\n'
+\end{code}