diff options
| author | simonpj <unknown> | 2001-06-25 08:10:03 +0000 |
|---|---|---|
| committer | simonpj <unknown> | 2001-06-25 08:10:03 +0000 |
| commit | d069cec2bd92d4156aeab80f7eb1f222a82e4103 (patch) | |
| tree | f50bd239110777d3e9effa526df25b667fdb176e /ghc/compiler/hsSyn/HsLit.lhs | |
| parent | 3622a7de695b4cb795171c8cb59bfe41c7f4d85f (diff) | |
| download | haskell-d069cec2bd92d4156aeab80f7eb1f222a82e4103.tar.gz | |
[project @ 2001-06-25 08:09:57 by simonpj]
----------------
Squash newtypes
----------------
This commit squashes newtypes and their coerces, from the typechecker
onwards. The original idea was that the coerces would not get in the
way of optimising transformations, but despite much effort they continue
to do so. There's no very good reason to retain newtype information
beyond the typechecker, so now we don't.
Main points:
* The post-typechecker suite of Type-manipulating functions is in
types/Type.lhs, as before. But now there's a new suite in types/TcType.lhs.
The difference is that in the former, newtype are transparent, while in
the latter they are opaque. The typechecker should only import TcType,
not Type.
* The operations in TcType are all non-monadic, and most of them start with
"tc" (e.g. tcSplitTyConApp). All the monadic operations (used exclusively
by the typechecker) are in a new module, typecheck/TcMType.lhs
* I've grouped newtypes with predicate types, thus:
data Type = TyVarTy Tyvar | ....
| SourceTy SourceType
data SourceType = NType TyCon [Type]
| ClassP Class [Type]
| IParam Type
[SourceType was called PredType.] This is a little wierd in some ways,
because NTypes can't occur in qualified types. However, the idea is that
a SourceType is a type that is opaque to the type checker, but transparent
to the rest of the compiler, and newtypes fit that as do implicit parameters
and dictionaries.
* Recursive newtypes still retain their coreces, exactly as before. If
they were transparent we'd get a recursive type, and that would make
various bits of the compiler diverge (e.g. things which do type comparison).
* I've removed types/Unify.lhs (non-monadic type unifier and matcher),
merging it into TcType.
Ditto typecheck/TcUnify.lhs (monadic unifier), merging it into TcMType.
Diffstat (limited to 'ghc/compiler/hsSyn/HsLit.lhs')
| -rw-r--r-- | ghc/compiler/hsSyn/HsLit.lhs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ghc/compiler/hsSyn/HsLit.lhs b/ghc/compiler/hsSyn/HsLit.lhs index 7111cbde2b..2e33073152 100644 --- a/ghc/compiler/hsSyn/HsLit.lhs +++ b/ghc/compiler/hsSyn/HsLit.lhs @@ -39,7 +39,20 @@ data HsLit -- must resolve to boxed-primitive! -- The Type in HsLitLit is needed when desuaring; -- before the typechecker it's just an error value - deriving( Eq ) + +instance Eq HsLit where + (HsChar x1) == (HsChar x2) = x1==x2 + (HsCharPrim x1) == (HsCharPrim x2) = x1==x2 + (HsString x1) == (HsString x2) = x1==x2 + (HsStringPrim x1) == (HsStringPrim x2) = x1==x2 + (HsInt x1) == (HsInt x2) = x1==x2 + (HsIntPrim x1) == (HsIntPrim x2) = x1==x2 + (HsInteger x1) == (HsInteger x2) = x1==x2 + (HsRat x1 _) == (HsRat x2 _) = x1==x2 + (HsFloatPrim x1) == (HsFloatPrim x2) = x1==x2 + (HsDoublePrim x1) == (HsDoublePrim x2) = x1==x2 + (HsLitLit x1 _) == (HsLitLit x2 _) = x1==x2 + lit1 == lit2 = False data HsOverLit -- An overloaded literal = HsIntegral Integer -- Integer-looking literals; |
