summaryrefslogtreecommitdiff
path: root/ghc/compiler/utils/Outputable.lhs
diff options
context:
space:
mode:
authorsimonpj <unknown>2004-09-30 10:40:21 +0000
committersimonpj <unknown>2004-09-30 10:40:21 +0000
commit23f40f0e9be6d4aa5cf9ea31d73f4013f8e7b4bd (patch)
treea4b1953b8d2f49d06a05a9d0cc49485990649cd8 /ghc/compiler/utils/Outputable.lhs
parent9b6858cb53438a2651ab00202582b13f95036058 (diff)
downloadhaskell-23f40f0e9be6d4aa5cf9ea31d73f4013f8e7b4bd.tar.gz
[project @ 2004-09-30 10:35:15 by simonpj]
------------------------------------ Add Generalised Algebraic Data Types ------------------------------------ This rather big commit adds support for GADTs. For example, data Term a where Lit :: Int -> Term Int App :: Term (a->b) -> Term a -> Term b If :: Term Bool -> Term a -> Term a ..etc.. eval :: Term a -> a eval (Lit i) = i eval (App a b) = eval a (eval b) eval (If p q r) | eval p = eval q | otherwise = eval r Lots and lots of of related changes throughout the compiler to make this fit nicely. One important change, only loosely related to GADTs, is that skolem constants in the typechecker are genuinely immutable and constant, so we often get better error messages from the type checker. See TcType.TcTyVarDetails. There's a new module types/Unify.lhs, which has purely-functional unification and matching for Type. This is used both in the typechecker (for type refinement of GADTs) and in Core Lint (also for type refinement).
Diffstat (limited to 'ghc/compiler/utils/Outputable.lhs')
-rw-r--r--ghc/compiler/utils/Outputable.lhs17
1 files changed, 9 insertions, 8 deletions
diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs
index 22856f1a28..8b52867677 100644
--- a/ghc/compiler/utils/Outputable.lhs
+++ b/ghc/compiler/utils/Outputable.lhs
@@ -42,10 +42,10 @@ module Outputable (
showSDocUnqual, showsPrecSDoc,
pprHsChar, pprHsString,
-
-- error handling
- pprPanic, pprPanic#, pprError, pprTrace, assertPprPanic, warnPprTrace,
- trace, panic, panic#, assertPanic
+ pprPanic, assertPprPanic, pprPanic#, pprPgmError,
+ pprTrace, warnPprTrace,
+ trace, pgmError, panic, panic#, assertPanic
) where
#include "HsVersions.h"
@@ -470,12 +470,13 @@ speakNTimes t | t == 1 = ptext SLIT("once")
%************************************************************************
\begin{code}
-pprPanic :: String -> SDoc -> a
-pprError :: String -> SDoc -> a
+pprPanic, pprPgmError :: String -> SDoc -> a
pprTrace :: String -> SDoc -> a -> a
-pprPanic = pprAndThen panic
-pprError = pprAndThen error
-pprTrace = pprAndThen trace
+pprPanic = pprAndThen panic -- Throw an exn saying "bug in GHC"
+
+pprPgmError = pprAndThen pgmError -- Throw an exn saying "bug in pgm being compiled"
+ -- (used for unusual pgm errors)
+pprTrace = pprAndThen trace
pprPanic# heading pretty_msg = panic# (show (doc PprDebug))
where