From: qrczak Date: Tue, 20 Feb 2001 18:40:54 +0000 (+0000) Subject: [project @ 2001-02-20 18:40:54 by qrczak] X-Git-Tag: Approximately_9120_patches~2576 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=8c2df3eadf32517d1c1b7ff3d6d9404f40dfe288;p=ghc-hetmet.git [project @ 2001-02-20 18:40:54 by qrczak] Apply tweaks needed to let this compile: remove syn_map argument from typecheckExpr in HscMain, import PrelNum.fromInt to modules which use integer literals with -fno-implicit-prelude flag. It crashes later, on Directory.hs: ghc: panic! (the `impossible' happened): srtExpr I'm not sure if resolving numeric literals to top-level definitions of fromInt/fromInteger with -fno-implicit-prelude is a good idea. Using names from whatever module is called Prelude would be IMHO better, probably when -fglasgow-exts is given. Prel* modules themselves would import PrelNum as Prelude. Both schemes break for fromInt, which is non-standard and by default it's visible neither at the top level nor in the Prelude module. My proposal for dealing with it is as follows (assuming that fromInteger is taken from the module locally called Prelude instead of the top level): when the standard Prelude is used, take fromInt from PrelNum; when a Prelude replacement is used, use fromInt from it if available, otherwise use its fromInteger instead. That way Prelude replacements can ignore this non-standard extension and get the expected behavior, or they can also choose to use this extension (in a way compatible with Haskell implementations which allow to replace Prelude but don't have fromInt). --- diff --git a/ghc/compiler/main/HscMain.lhs b/ghc/compiler/main/HscMain.lhs index 2217126..7df53e2 100644 --- a/ghc/compiler/main/HscMain.lhs +++ b/ghc/compiler/main/HscMain.lhs @@ -431,7 +431,7 @@ hscExpr dflags wrap_io hst hit pcs0 this_module expr -- Typecheck it maybe_tc_return - <- typecheckExpr dflags wrap_io syn_map pcs1 hst print_unqual this_module rn_expr; + <- typecheckExpr dflags wrap_io pcs1 hst print_unqual this_module rn_expr; case maybe_tc_return of { Nothing -> return ({-WAS:pcs1-} pcs0, Nothing); Just (pcs2, tc_expr, ty) -> do diff --git a/ghc/lib/std/PrelByteArr.lhs b/ghc/lib/std/PrelByteArr.lhs index 76e6d17..04e0b1a 100644 --- a/ghc/lib/std/PrelByteArr.lhs +++ b/ghc/lib/std/PrelByteArr.lhs @@ -1,5 +1,5 @@ % ----------------------------------------------------------------------------- -% $Id: PrelByteArr.lhs,v 1.10 2001/01/11 17:25:57 simonmar Exp $ +% $Id: PrelByteArr.lhs,v 1.11 2001/02/20 18:40:54 qrczak Exp $ % % (c) The University of Glasgow, 1994-2000 % @@ -18,6 +18,7 @@ import PrelArr import PrelFloat import PrelST import PrelBase +import PrelNum ( fromInt ) \end{code} %********************************************************* diff --git a/ghc/lib/std/PrelIOBase.lhs b/ghc/lib/std/PrelIOBase.lhs index 6ef3f27..7bf96d1 100644 --- a/ghc/lib/std/PrelIOBase.lhs +++ b/ghc/lib/std/PrelIOBase.lhs @@ -1,5 +1,5 @@ % ------------------------------------------------------------------------------ -% $Id: PrelIOBase.lhs,v 1.33 2001/02/06 11:42:30 simonmar Exp $ +% $Id: PrelIOBase.lhs,v 1.34 2001/02/20 18:40:54 qrczak Exp $ % % (c) The University of Glasgow, 1994-2000 % @@ -21,7 +21,7 @@ import {-# SOURCE #-} PrelErr ( error ) import PrelST import PrelBase -import PrelNum ( fromInteger ) -- Integer literals +import PrelNum ( fromInt ) -- Integer literals import PrelMaybe ( Maybe(..) ) import PrelShow import PrelList diff --git a/ghc/lib/std/PrelST.lhs b/ghc/lib/std/PrelST.lhs index 735426d..6c8ee76 100644 --- a/ghc/lib/std/PrelST.lhs +++ b/ghc/lib/std/PrelST.lhs @@ -1,5 +1,5 @@ % ------------------------------------------------------------------------------ -% $Id: PrelST.lhs,v 1.17 2000/09/25 12:58:39 simonpj Exp $ +% $Id: PrelST.lhs,v 1.18 2001/02/20 18:40:54 qrczak Exp $ % % (c) The University of Glasgow, 1992-2000 % @@ -11,7 +11,7 @@ module PrelST where -import PrelNum ( fromInteger ) -- For integer literals +import PrelNum ( fromInt ) -- For integer literals import PrelShow import PrelBase import PrelNum () -- So that we get the .hi file for system imports