From 56df29b6c7a5e5763679366a3a126125579e716f Mon Sep 17 00:00:00 2001 From: sewardj Date: Tue, 11 Jan 2000 14:21:43 +0000 Subject: [PATCH] [project @ 2000-01-11 14:21:43 by sewardj] Add nameShow and namePutStr as hooks for said fns so that evaluator() in hugs.c can refer to them in a style consistent with the way the rest of Hugs refers to specific symbol names. --- ghc/interpreter/hugs.c | 12 +++++++----- ghc/interpreter/link.c | 51 +++++++++++++++++++++++++++++------------------- ghc/interpreter/link.h | 3 +++ 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/ghc/interpreter/hugs.c b/ghc/interpreter/hugs.c index 4292db8..d788d47 100644 --- a/ghc/interpreter/hugs.c +++ b/ghc/interpreter/hugs.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: hugs.c,v $ - * $Revision: 1.34 $ - * $Date: 2000/01/10 16:27:03 $ + * $Revision: 1.35 $ + * $Date: 2000/01/11 14:21:43 $ * ------------------------------------------------------------------------*/ #include @@ -320,6 +320,7 @@ String argv[]; { } addStackEntry("Prelude"); + if (combined) addStackEntry("PrelHugs"); for (i=1; i < argc; ++i) { /* process command line arguments */ if (strcmp(argv[i], "--")==0) break; @@ -1385,6 +1386,7 @@ static Void local evaluator() { /* evaluate expr and print value */ checkExp(); defaultDefns = evalDefaults; type = typeCheckExp(TRUE); + if (isPolyType(type)) { ks = polySigOf(type); bd = monotypeOf(type); @@ -1418,9 +1420,9 @@ static Void local evaluator() { /* evaluate expr and print value */ ERRTEXT "\n" EEND; } - inputExpr = ap2(findName(findText("show")),d,inputExpr); - inputExpr = ap(findName(findText("putStr")), inputExpr); - inputExpr = ap(nameRunIO_toplevel, inputExpr); + inputExpr = ap2(nameShow, d,inputExpr); + inputExpr = ap (namePutStr, inputExpr); + inputExpr = ap (nameRunIO_toplevel, inputExpr); evalExp(); printf("\n"); if (addType) { diff --git a/ghc/interpreter/link.c b/ghc/interpreter/link.c index 89d63ca..57c552d 100644 --- a/ghc/interpreter/link.c +++ b/ghc/interpreter/link.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: link.c,v $ - * $Revision: 1.31 $ - * $Date: 2000/01/10 17:19:33 $ + * $Revision: 1.32 $ + * $Date: 2000/01/11 14:21:43 $ * ------------------------------------------------------------------------*/ #include "prelude.h" @@ -89,6 +89,8 @@ Name nameBind; /* for translating monad comps */ Name nameZero; /* for monads with a zero */ Name nameId; +Name nameShow; +Name namePutStr; Name nameRunIO_toplevel; Name namePrint; @@ -331,7 +333,8 @@ Void linkPreludeTC(void) { /* Hook to tycons and classes in */ classFloating = linkClass("Floating"); classNum = linkClass("Num"); classMonad = linkClass("Monad"); - +assert(nonNull(typeDouble)); +assert(nonNull(typeInteger)); stdDefaults = NIL; stdDefaults = cons(typeDouble,stdDefaults); # if DEFAULT_BIGNUM @@ -378,6 +381,7 @@ Void linkPreludeTC(void) { /* Hook to tycons and classes in */ */ name(namePrimTakeMVar).type = primType(MONAD_Id, "rbc", "d"); + if (combined) { for (i=2; i<=NUM_DTUPLES; i++) {/* Add derived instances of tuples */ addTupInst(classEq,i); addTupInst(classOrd,i); @@ -386,6 +390,7 @@ Void linkPreludeTC(void) { /* Hook to tycons and classes in */ addTupInst(classRead,i); addTupInst(classBounded,i); } + } } } @@ -424,9 +429,11 @@ Void linkPreludeCM(void) { /* Hook to cfuns and mfuns in */ nameInRange = linkName("inRange"); nameMinus = linkName("-"); /* These come before calls to implementPrim */ + if (combined) { for(i=0; i