From 0a9b1362c9103c17a9f662287fd65c8779bcf4ef Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 28 Mar 2008 21:19:19 +0000 Subject: [PATCH] Print out rational literals correctly in External Core The External Core printer was printing out rational literals of the form: 2.0e-2 when the External Core grammar doesn't allow this. (This bug has apparently been there since the beginning...) It's now printing rationals in the same form that (show (r::Rational)) does. This requires a parser change as well (soon to come.) --- compiler/coreSyn/PprExternalCore.lhs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/coreSyn/PprExternalCore.lhs b/compiler/coreSyn/PprExternalCore.lhs index c58144c..dd75b62 100644 --- a/compiler/coreSyn/PprExternalCore.lhs +++ b/compiler/coreSyn/PprExternalCore.lhs @@ -190,7 +190,9 @@ palt (Adefault e) = plit :: Lit -> Doc plit (Lint i t) = parens (integer i <> text "::" <> pty t) -plit (Lrational r t) = parens (rational r <> text "::" <> pty t) -- might be better to print as two integers +-- we use (text (show r)) because "(rational r)" was printing out things +-- like "2.0e-2" (which isn't External Core) +plit (Lrational r t) = parens (text (show r) <> text "::" <> pty t) plit (Lchar c t) = parens (text ("\'" ++ escape [c] ++ "\'") <> text "::" <> pty t) plit (Lstring s t) = parens (pstring s <> text "::" <> pty t) -- 1.7.10.4