From 34271c2f24007d08f4e1077238cae0c8fa740342 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 11 Mar 2009 11:23:11 +0000 Subject: [PATCH] FIX #2816 (correct unicode output for :type/:kind) This is just a hack, since we don't have correct unicode output for Handles in general, I just fixed a couple of places where we were not converting to UTF-8 for output. --- compiler/ghci/InteractiveUI.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 9feae0e..327cf14 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -1215,14 +1215,20 @@ typeOfExpr str ty <- GHC.exprType str dflags <- getDynFlags let pefas = dopt Opt_PrintExplicitForalls dflags - printForUser $ sep [text str, nest 2 (dcolon <+> pprTypeForUser pefas ty)] + printForUser $ sep [utext str, nest 2 (dcolon <+> pprTypeForUser pefas ty)] kindOfType :: String -> GHCi () kindOfType str = handleSourceError (\e -> GHC.printExceptionAndWarnings e) $ do ty <- GHC.typeKind str - printForUser $ text str <+> dcolon <+> ppr ty + printForUser $ utext str <+> dcolon <+> ppr ty +-- HACK for printing unicode text. We assume the output device +-- understands UTF-8, and go via FastString which converts to UTF-8. +-- ToDo: fix properly when we have encoding support in Handles. +utext :: String -> SDoc +utext str = ftext (mkFastString str) + quit :: String -> GHCi Bool quit _ = return True -- 1.7.10.4