From 55db5c327ad5931daecb84078c7abffb27bed1d8 Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Wed, 24 Mar 1999 18:21:21 +0000
Subject: [PATCH] [project @ 1999-03-24 18:21:21 by sof] In case the desugaring
 of a lit-lit should fail, give a more informative error msg

---
 ghc/compiler/deSugar/DsExpr.lhs | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ghc/compiler/deSugar/DsExpr.lhs b/ghc/compiler/deSugar/DsExpr.lhs
index 622b4ef72cfe..2b26091ee494 100644
--- a/ghc/compiler/deSugar/DsExpr.lhs
+++ b/ghc/compiler/deSugar/DsExpr.lhs
@@ -184,7 +184,19 @@ dsExpr (HsLitOut (HsString str) _)
   = returnDs (mkLit (NoRepStr str stringTy))
 
 dsExpr (HsLitOut (HsLitLit str) ty)
-  = returnDs ( mkConApp data_con [mkLit (MachLitLit str prim_ty)] )
+  = case (maybeBoxedPrimType ty) of
+      Just (boxing_data_con, prim_ty) ->
+	    returnDs ( mkConApp boxing_data_con [mkLit (MachLitLit str prim_ty)] )
+      _ -> 
+	pprError "ERROR:"
+		 (vcat
+		   [ hcat [ text "Cannot see data constructor of ``literal-literal''s type: "
+		         , text "value:", quotes (quotes (ptext str))
+		         , text "; type: ", ppr ty
+		         ]
+		   , text "Try compiling with -fno-prune-tydecls."
+		   ])
+		  
   where
     (data_con, prim_ty)
       = case (maybeBoxedPrimType ty) of
-- 
GitLab