Frank A. Christoph: FastString in GHC

1999-08-23 Thread simonmar


I have been looking at the GHC 4.04 sources a little lately and in the
module FastString (in ghc/compiler/utils), the instance for Eq is defined as
follows:

  instance Eq FastString where
a == b = case cmpFS a b of { LT - False; EQ - true; GT - False }
...

and cmpFS will return EQ if the unique IDs of a and b match, otherwise it
just does a ccall to strcmp.

What I don't understand is why you don't just define (==) so that to
FastStrings are equal if and _only_ if their unique IDs are equal. Isn't the
whole point of FastString that identical strings and only identical strings
will get the same ID? The ID's not the string's hash value, as far as I can
see, and with the present definition you will check each character in the
string when the result of (==) is False.

Am I missing something?

- --FC



Re: Cyclic compilation dependencies...

1998-10-06 Thread simonmar


8Qxd$QC/sdeK{93/{KA]T@gir{b8(rd5/zL85UcsTGty!z9Nx%Z+0e193YVEXFcWdM.]+uyVYA6 
WNNn]tdh-oQ]/#\R;Vts^}W]a%+%VqSEAu
X-URL: http://WWW.CS.Yale.EDU/homes/reid-alastair/
Date: Tue, 06 Oct 1998 09:58:33 -0300
From: Alastair Reid [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
Precedence: bulk
Resent-Date:  Tue, 6 Oct 1998 15:45:12 +0100
Resent-From: [EMAIL PROTECTED]
Resent-To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"


 Tim Hemel [EMAIL PROTECTED] writes:
  I am trying to make a port skeleton for the BSD ports selection for GHC.
  [but happy depends on ghc depends on happy ...]
  How do I get out of this mutual recursion?
 
 You start off with a binary distribution of one of the packages.

Simon Marlow writes:
 You'll need GHC installed in order to compile GHC in any case

Or you can use Hugs to execute happy using something like this:

  runhugs -h10m Happy.hs MyGrammar.y and other options

It'll probably take a few minutes to run but you've only got to do it once.
(btw I've never tried this route with GHC's parser - but I've done it when
 working on the greencard parser and it worked pretty well.)

Alastair




Re: Extra output lines from trace.

1998-07-30 Thread simonmar


8Qxd$QC/sdeK{93/{KA]T@gir{b8(rd5/zL85UcsTGty!z9Nx%Z+0e193YVEXFcWdM.]+uyVYA6 
WNNn]tdh-oQ]/#\R;Vts^}W]a%+%VqSEAu
X-URL: http://WWW.CS.Yale.EDU/homes/reid-alastair/
Date: Thu, 30 Jul 1998 14:29:45 -0300
From: Alastair Reid [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
Precedence: bulk
Resent-Date:  Thu, 30 Jul 1998 19:30:08 +0100
Resent-From: [EMAIL PROTECTED]
Resent-To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"


Lars Lundgren [EMAIL PROTECTED] writes:
  Not a bug, but annoying:
  
  Every application of trace generates three extra lines which makes it less
  usefull IMO (compared to trace in hugs).

Simon Marlow replies:
 Compile and link the following C code with your Haskell program [...]

I personally prefer GHC's way of doing things since it pretty much guarantees
that people will not try to use trace as a sneaky way round Haskell's IO monad.

I also like what HBC (or maybe it's GHC - I forget) does which is to keep track
of nested calls to trace and indent the output accordingly.  This is trivial to
implement using GHC's Pre/PostTraceHooks (if it's not already being done).


[GHC folks: IOExts.trace doesn't say much about what trace is meant to do.
I'm happy to say it does what GHC does.]


-- 
Alastair Reid  Yale Haskell Project Hacker
[EMAIL PROTECTED]  http://WWW.CS.Yale.EDU/homes/reid-alastair/





Re: problems compiling ghc 3.01 for linux

1998-05-11 Thread simonmar


8Qxd$QC/sdeK{93/{KA]T@gir{b8(rd5/zL85UcsTGty!z9Nx%Z+0e193YVEXFcWdM.]+uyVYA6 
WNNn]tdh-oQ]/#\R;Vts^}W]a%+%VqSEAu
X-URL: http://WWW.CS.Yale.EDU/homes/reid-alastair/
Date: Mon, 11 May 1998 11:03:09 -0300
From: Alastair Reid [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
Precedence: bulk
Resent-Date:  Mon, 11 May 1998 16:07:11 +0100
Resent-From: [EMAIL PROTECTED]
Resent-To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"


 we still don't have any recent Linux installations here
 to test out a proper fix on.  

Surely someone at Glasgow CS dept can lend you the Redhat CD ROM
 and boot disk?  
If not, Computer World (I think that's the name) isn't too far away.
Or you could order direct from Redhat.  Or save money by ordering
 from Cheap Bytes (but better to pay extra to RH to support further
 development).
Or you can upgrade by ftp - I'm sure there's a mirror near you.

Upgrading only takes about 15 minutes of work - and a couple of hours
of ignoring the machine while it copies files.

(Time estimate based on my experience of Redhat 5.0.  I'm not sure
 how good the other distributions are for upgrading.)

Alastair




Re: Anomaly in IO in GHC (I think)

1998-03-25 Thread simonmar


8Qxd$QC/sdeK{93/{KA]T@gir{b8(rd5/zL85UcsTGty!z9Nx%Z+0e193YVEXFcWdM.]+uyVYA6 
WNNn]tdh-oQ]/#\R;Vts^}W]a%+%VqSEAu
X-URL: http://WWW.CS.Yale.EDU/homes/reid-alastair/
Date: Wed, 25 Mar 1998 11:51:40 -0500
From: Alastair Reid [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
Precedence: bulk
Resent-Date:  Wed, 25 Mar 1998 16:52:53 +
Resent-From: [EMAIL PROTECTED]
Resent-To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"


[Reply redirected to bug mailing lists and copied to the library czar]

Sigbjorn writes:
 GHC's behaviour [of Prelude.interact] is consistent with the
 report, Hugs' isn't.

Hugs deliberately deviates from the report (ie turns 
echoing off when running interact) because the report is
clearly broken.

The only reason for including "interact" in the Prelude is so
that you can write:

   interact (map toUpper)

and the like.  This is only useful if echoing is turned off - so we do.


Alastair

ps The URL Sigbjorn posted should be:
  
   http://www.dcs.gla.ac.uk/mail-www/haskell/msg00270.html

and this doesn't contain a link to all the followups:

  http://www.dcs.gla.ac.uk/mail-www/haskell/msg00272.html
  http://www.dcs.gla.ac.uk/mail-www/haskell/msg00273.html
  http://www.dcs.gla.ac.uk/mail-www/haskell/msg00277.html

(Sigbjorn: any chance of adding a "possible followups" 
 list as well as the "followups" list?)