toUpper Bug?

Alastair David Reid reid@cs.utah.edu
15 Aug 2001 16:24:48 -0600


[reply just sent to hugs-bugs]

> Maybe if this one is going to be fixed, toUpper could be put in the
> correct library as well?

I'm assuming this is a reference to the fact that toUpper is exported
both from Char (correct) and from Prelude (incorrect)?

A quick check of Prelude.hs and hugs98/src/*.c reveals no good reason
why this code is in the Prelude.  Perhaps some vague code tidiness
argument about keeping related code together?

So, it could be fixed quite easily but there's a bunch of similar
deviations from the standard which are not easily fixed because the
Prelude (or some part of the Hugs compiler) depends on the function
which, with the current Hugs implementation, implies that there has to
be a copy in the Prelude.  

We don't want to make 2 copies of the same code though (one in the
Prelude but not exported, one in the correct place and exported)
because it leads to code maintenance problems.  Suppose that toUpper
had a bug in it - it'd be so easy to fix one copy and forget about the
existence of the second.

Another fix (the preferred fix) is to improve the Hugs compiler so
that the code can have (almost) the same structure as in the report.
We know how to do this (STG-Hugs had it) but it'll take a bit of time
to figure out again exactly which changes are required because the
special treatment of the Prelude is deeply wired into Hugs.  (More
precisely, it'll take me a bit of time to find the time to look
through the relevant archives.)

-- 
Alastair Reid        reid@cs.utah.edu        http://www.cs.utah.edu/~reid/