Re: replacing the Prelude (again)

2002-07-17 Thread Dylan Thurston
On Tue, Jul 16, 2002 at 04:02:44PM +1000, Bernard James POPE wrote: I would like to use do-notation in the transformed program, but have it refer to Prelude.Monad and not MyPrelude.Monad which is also in scope. Why do you have a MyPrelude.Monad (different from Prelude.Monad) if you don't want

RE: replacing the Prelude (again)

2002-07-16 Thread Simon Peyton-Jones
|Ambiguities in the class Num are most common, so Haskell | provides another |way to resolve them---with a default declaration: |default (t1 , ... , tn) |where n=0, and each ti must be a monotype for which Num ti holds. |

RE: replacing the Prelude (again)

2002-07-15 Thread Simon Peyton-Jones
I'm fond of the idea proposed by Marcin 'Qrczak' Kowalczyk: | May I propose an alternative way of specifying an alternative Prelude? | Instead of having a command line switch, let's say that 3 always means | Prelude.fromInteger 3 - for any *module Prelude* which is in scope! That's a

RE: replacing the Prelude (again)

2002-07-15 Thread Ashley Yakeley
At 2002-07-15 01:05, Simon Peyton-Jones wrote: I quite like the fact that you would then have to say import MyPrelude as Prelude thereby stressing that you are importing the Prelude stuff. Doesn't this assume your Prelude stuff is all in one module? Or can you import several modules

Re: replacing the Prelude (again)

2002-07-15 Thread Malcolm Wallace
| anymore. What I would like is that the defualting rules refer | to the classes in my version of the Prelude, | not the Standard Prelude. You can always get that (with the -fno-implicit-prelude thing) by adding default [Int, Double] or whatever to your source module, just after

RE: replacing the Prelude (again)

2002-07-15 Thread Bernard James POPE
Hi All, Thanks to everyone for their comments. I can see that this is quite a difficult design problem, and it is unlikely that one solution will please everyone, which makes me think that the current solution will probably stand. Simon Peyton-Jones writes: Bernie writes: | anymore. What I

Re: replacing the Prelude (again)

2002-07-15 Thread Bernard James POPE
Hi again, Malcolm writes: We came across the same problem in the Hat tracer (which is also a source-to-source transformation, and can also be used for debugging). The problem is that the transformation introduces new classes, so Prelude.Ord - HatPrelude.Ord Prelude.Eq -

Re: replacing the Prelude (again)

2002-07-15 Thread Malcolm Wallace
The defaulting mechanism *only* applies to types constrained by the original builtin Prelude.Num, not to the transformed class HatPrelude.Num. I did wonder how Hat tackled this. Out of curiosity what is the solution that Hat uses? Hat doesn't have a solution. When the lack of correct

Re: replacing the Prelude (again)

2002-07-15 Thread Bernard James POPE
Malcolm writes: Bernie writes: I did wonder how Hat tackled this. Out of curiosity what is the solution that Hat uses? Hat doesn't have a solution. When the lack of correct defaulting causes Hat to generate type-incorrect code, the underlying compiler will complain vociferously. Our

RE: Replacing the Prelude

2002-06-03 Thread Ashley Yakeley
Ping! At 2002-05-14 07:17, Simon Peyton-Jones wrote: Ashley writes | I was hoping to do something similar for 'do' notation by redefining | (), (=) etc., but unfortunately GHC is quite insistent | that 'do' notation quite specifically refers to GHC.Base.Monad Dylan replies | I'm

Re: Replacing the Prelude

2002-05-14 Thread Dylan Thurston
On Sun, May 12, 2002 at 09:31:38PM -0700, Ashley Yakeley wrote: I have recently been experimenting writing code that replaces large chunks of the Prelude, compiling with -fno-implicit-prelude. I notice that I can happily redefine numeric literals simply by creating functions called

RE: Replacing the Prelude

2002-05-14 Thread Simon Peyton-Jones
Ashley writes | I was hoping to do something similar for 'do' notation by redefining | (), (=) etc., but unfortunately GHC is quite insistent | that 'do' notation quite specifically refers to GHC.Base.Monad Dylan replies | I'm surprised that ghc uses the fromInteger and fromRational |