Fix Trac #2246; overhaul handling of overloaded literals
authorsimonpj@microsoft.com <unknown>
Tue, 6 May 2008 10:25:51 +0000 (10:25 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 6 May 2008 10:25:51 +0000 (10:25 +0000)
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


No differences found