patch applied (ghc): Fix Trac #2246;
overhaul handling of overloaded literals
Simon Peyton Jones
simonpj at microsoft.com
Tue May 6 06:32:31 EDT 2008
Tue May 6 03:25:51 PDT 2008 simonpj at microsoft.com
* Fix Trac #2246; overhaul handling of overloaded literals
The real work of fixing Trac #2246 is to use shortCutLit in
MatchLit.dsOverLit, so that type information discovered late in the
day by the type checker can still be exploited during desugaring.
However, as usual I found myself doing some refactoring along the
way, to tidy up the handling of overloaded literals. The main
change is to split HsOverLit into a record, which in turn uses
a sum type for the three variants. This makes the code significantly
more modular.
data HsOverLit id
= OverLit {
ol_val :: OverLitVal,
ol_rebindable :: Bool, -- True <=> rebindable syntax
-- False <=> standard syntax
ol_witness :: SyntaxExpr id, -- Note [Overloaded literal witnesses]
ol_type :: PostTcType }
data OverLitVal
= HsIntegral !Integer -- Integer-looking literals;
| HsFractional !Rational -- Frac-looking literals
| HsIsString !FastString -- String-looking literals
M ./compiler/deSugar/Check.lhs -5 +5
M ./compiler/deSugar/DsMeta.hs -4 +7
M ./compiler/deSugar/MatchLit.lhs -33 +48
M ./compiler/hsSyn/HsLit.lhs -36 +54
M ./compiler/hsSyn/HsUtils.lhs -3 +7
M ./compiler/parser/RdrHsSyn.lhs -1 +1
M ./compiler/rename/RnPat.lhs -30 +32
M ./compiler/typecheck/Inst.lhs -79 +29
M ./compiler/typecheck/TcHsSyn.lhs -12 +43
M ./compiler/typecheck/TcPat.lhs -39 +13
View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20080506102551-1287e-95dc699365f8482cc5712dc4164e046a896b0cf9.gz
More information about the Cvs-ghc
mailing list