<commit_before>%
% (c) The University of Glasgow 2006
% (c) The GRASP Project, Glasgow University, 1992-1998
%

\begin{code}
-- | This module defines classes and functions for pretty-printing. It also
-- exports a number of helpful debugging and other utilities such as 'trace' and 'panic'.
--
-- The interface to this module is very similar to the standard Hughes-PJ pretty printing
-- module, except that it exports a number of additional functions that are rarely used,
-- and works over the 'SDoc' type.
module Outputable (
	-- * Type classes
	Outputable(..), OutputableBndr(..),

        -- * Pretty printing combinators
	SDoc,
	docToSDoc,
	interppSP, interpp'SP, pprQuotedList, pprWithCommas, quotedListWithOr,
	empty, nest,
	char,
	text, ftext, ptext,
	int, integer, float, double, rational,
	parens, cparen, brackets, braces, quotes, doubleQuotes, angleBrackets,
	semi, comma, colon, dcolon, space, equals, dot, arrow, darrow,
	lparen, rparen, lbrack, rbrack, lbrace, rbrace, underscore,
	blankLine,
	(<>), (<+>), hcat, hsep, 
	($$), ($+$), vcat,
	sep, cat, 
	fsep, fcat, 
	hang, punctuate, ppWhen, ppUnless,
	speakNth, speakNTimes, speakN, speakNOf, plural,

        -- * Converting 'SDoc' into strings and outputing it
	printSDoc, printErrs, printOutput, hPrintDump, printDump,
	printForC, printForAsm, printForUser, printForUserPartWay,
	pprCode, mkCodeStyle,
	showSDoc, showSDocOneLine,
        showSDocForUser, showSDocDebug, showSDocDump, showSDocDumpOneLine,
        showPpr,
	showSDocUnqual, showsPrecSDoc,

	pprInfixVar, pprPrefixVar,
	pprHsChar, pprHsString, pprHsInfix, pprHsVar,
        pprFastFilePath,

        -- * Controlling the style in which output is printed
	BindingSite(..),

	PprStyle, CodeStyle(..), PrintUnqualified, alwaysQualify, neverQualify,
        QualifyName(..),
	getPprStyle, withPprStyle, withPprStyleDoc, 
	pprDeeper, pprDeeperList, pprSetDepth,
	codeStyle, userStyle, debugStyle, dumpStyle, asmStyle,
	ifPprDebug, qualName, qualModule,
	mkErrStyle, defaultErrStyle, defaultDumpStyle, defaultUserStyle,
        mkUserStyle, cmdlineParserStyle, Depth(..),
	
	-- * Error handling and debugging utilities
	pprPanic, pprSorry, assertPprPanic, pprPanicFastInt, pprPgmError, 
	pprTrace, warnPprTrace,
	trace, pgmError, panic, sorry, panicFastInt, assertPanic
    ) where

import {-# SOURCE #-} 	Module( Module, ModuleName, moduleName )
import {-# SOURCE #-} 	OccName( OccName )

import StaticFlags
import FastString 
import FastTypes
import qualified Pretty
import Pretty		( Doc, Mode(..) )
import Panic

import Data.Char
import qualified Data.Map as M
import qualified Data.IntMap as IM
import Data.Word
import System.IO	( Handle, stderr, stdout, hFlush )
import System.FilePath


#if __GLASGOW_HASKELL__ >= 701
import GHC.Show		( showMultiLineString )
#else
showMultiLineString :: String -> [String]
-- Crude version
showMultiLineString s = [s]
#endif
\end{code}



%************************************************************************
%*									*
\subsection{The @PprStyle@ data type}
%*									*
%************************************************************************

\begin{code}

data PprStyle
  = PprUser PrintUnqualified Depth
		-- Pretty-print in a way that will make sense to the
		-- ordinary user; must be very close to Haskell
		-- syntax, etc.<commit_msg>Fix multi-line string (minor glitch in stage-1 compiler)<commit_after>%
% (c) The University of Glasgow 2006
% (c) The GRASP Project, Glasgow University, 1992-1998
%

\begin{code}
-- | This module defines classes and functions for pretty-printing. It also
-- exports a number of helpful debugging and other utilities such as 'trace' and 'panic'.
--
-- The interface to this module is very similar to the standard Hughes-PJ pretty printing
-- module, except that it exports a number of additional functions that are rarely used,
-- and works over the 'SDoc' type.
module Outputable (
	-- * Type classes
	Outputable(..), OutputableBndr(..),

        -- * Pretty printing combinators
	SDoc,
	docToSDoc,
	interppSP, interpp'SP, pprQuotedList, pprWithCommas, quotedListWithOr,
	empty, nest,
	char,
	text, ftext, ptext,
	int, integer, float, double, rational,
	parens, cparen, brackets, braces, quotes, doubleQuotes, angleBrackets,
	semi, comma, colon, dcolon, space, equals, dot, arrow, darrow,
	lparen, rparen, lbrack, rbrack, lbrace, rbrace, underscore,
	blankLine,
	(<>), (<+>), hcat, hsep, 
	($$), ($+$), vcat,
	sep, cat, 
	fsep, fcat, 
	hang, punctuate, ppWhen, ppUnless,
	speakNth, speakNTimes, speakN, speakNOf, plural,

        -- * Converting 'SDoc' into strings and outputing it
	printSDoc, printErrs, printOutput, hPrintDump, printDump,
	printForC, printForAsm, printForUser, printForUserPartWay,
	pprCode, mkCodeStyle,
	showSDoc, showSDocOneLine,
        showSDocForUser, showSDocDebug, showSDocDump, showSDocDumpOneLine,
        showPpr,
	showSDocUnqual, showsPrecSDoc,

	pprInfixVar, pprPrefixVar,
	pprHsChar, pprHsString, pprHsInfix, pprHsVar,
        pprFastFilePath,

        -- * Controlling the style in which output is printed
	BindingSite(..),

	PprStyle, CodeStyle(..), PrintUnqualified, alwaysQualify, neverQualify,
        QualifyName(..),
	getPprStyle, withPprStyle, withPprStyleDoc, 
	pprDeeper, pprDeeperList, pprSetDepth,
	codeStyle, userStyle, debugStyle, dumpStyle, asmStyle,
	ifPprDebug, qualName, qualModule,
	mkErrStyle, defaultErrStyle, defaultDumpStyle, defaultUserStyle,
        mkUserStyle, cmdlineParserStyle, Depth(..),
	
	-- * Error handling and debugging utilities
	pprPanic, pprSorry, assertPprPanic, pprPanicFastInt, pprPgmError, 
	pprTrace, warnPprTrace,
	trace, pgmError, panic, sorry, panicFastInt, assertPanic
    ) where

import {-# SOURCE #-} 	Module( Module, ModuleName, moduleName )
import {-# SOURCE #-} 	OccName( OccName )

import StaticFlags
import FastString 
import FastTypes
import qualified Pretty
import Pretty		( Doc, Mode(..) )
import Panic

import Data.Char
import qualified Data.Map as M
import qualified Data.IntMap as IM
import Data.Word
import System.IO	( Handle, stderr, stdout, hFlush )
import System.FilePath


#if __GLASGOW_HASKELL__ >= 701
import GHC.Show         ( showMultiLineString )
#else
showMultiLineString :: String -> [String]
-- Crude version
showMultiLineString s = [ showList s "" ]
#endif
\end{code}



%************************************************************************
%*									*
\subsection{The @PprStyle@ data type}
%*									*
%************************************************************************

\begin{code}

data PprStyle
  = PprUser PrintUnqualified Depth
		-- Pretty-print in a way that will make sense to the
		-- ordinary user; must be very close to Haskell
		-- syntax, etc.
{'fraction_non_alphanumeric': 0.13978494623655913, 'fraction_numerical': 0.004629629629629629, 'mean_word_length': 4.484848484848484, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2335510', 'n_tokens_mistral': 2313, 'n_tokens_neox': 2154, 'n_words': 653}