Re: Again: Referential Equality

1999-07-28 Thread Hans Aberg
At 14:11 +0200 1999/07/27, Koen Claessen wrote: The contructs we add to the language are: type Ref a = ... ref :: a - Ref a deref :: Ref a - a (=) :: Ref a - Ref a - Bool This basically gives you ML-style but non-updatable references, but you can compare them for equality. You can

RE: Again: Referential Equality

1999-07-28 Thread Frank A. Christoph
So the two conditions if a `eq` b then F(a) `eq` F(b) if a `req` b then G(a) `req` G(b) will only lead to different classes of functions (homomorphisms with respect to different properties). The latter will in math more correspond to consider all underlying set functions,

Re: Again: Referential Equality

1999-07-28 Thread Fergus Henderson
On 27-Jul-1999, Andreas C. Doering [EMAIL PROTECTED] wrote: [Simon Peyton-Jones wrote:] [Andreas Doering wrote:] let x=[1..] in x==x would not terminate in the first case but succeed in the second. But, much worse let x = (a,b) in x `req` x = True but (a,b)

Re: Again: Referential Equality

1999-07-28 Thread Fergus Henderson
On 27-Jul-1999, Frank A. Christoph [EMAIL PROTECTED] wrote: I would like to have a comparison instruction that compares the internal reference of two objects. Let's call it "req". req :: a - a - Bool By coincidence, I was just looking at GHC's documentation on stable names and

Re: Again: Referential Equality

1999-07-28 Thread Fergus Henderson
On 27-Jul-1999, D. Tweed [EMAIL PROTECTED] wrote: On Tue, 27 Jul 1999, Simon Marlow wrote: req a b = unsafePerformIO $ do a' - makeStableName a b' - makeStableName b return (a' == b') That's exactly what to use in a situation like this. Pointer equality loses

Re: Again: Referential Equality

1999-07-28 Thread Fergus Henderson
On 27-Jul-1999, Hans Aberg [EMAIL PROTECTED] wrote: I think there is not a big problem with breaking "referential transparency"; the same think happens in pure math often and it is part of a normal procedure of constructing mathematical objects: Referential transparency means that if

RE: Again: Referential Equality

1999-07-28 Thread Frank A. Christoph
Fergus wrote: On 27-Jul-1999, Simon Marlow [EMAIL PROTECTED] wrote: I would like to have a comparison instruction that compares the internal reference of two objects. Let's call it "req". req :: a - a - Bool By coincidence, I was just looking at GHC's documentation on

Re: Again: Referential Equality

1999-07-28 Thread Fergus Henderson
On 27-Jul-1999, Theo Norvell [EMAIL PROTECTED] wrote: On Tue, 27 Jul 1999, Andreas C. Doering wrote: let x=[1..] in x==x would not terminate in the first case but succeed in the second. But, much worse let x = (a,b) in x `req` x = True but (a,b)

Re: Again: Referential Equality

1999-07-28 Thread Fergus Henderson
On 27-Jul-1999, Simon Marlow [EMAIL PROTECTED] wrote: I would like to have a comparison instruction that compares the internal reference of two objects. Let's call it "req". req :: a - a - Bool By coincidence, I was just looking at GHC's documentation on stable names and

Re: Again: Referential Equality

1999-07-28 Thread Lennart Augustsson
Fergus Henderson wrote: equal x y = unsafePerformIO $ do ptrEq - ptrEqual x y return (ptrEq || deep_equals x y) Note that unlike `req', `equal' here _is_ referentially transparent. No, it's not. If x and y are both bottom you can get unexpected

Re: Haskell 98

1999-07-28 Thread Sven Panne
Fergus Henderson wrote: There are lots of examples where this sort of things causes real problems in practice. If you think this is not a problem in the real world then I suggest you read the archives [...] OK, I'll rephrase my opinion a little bit: Thanks to the "wise" decision to use

Re: Again: Referential Equality

1999-07-28 Thread Hans Aberg
At 14:02 +0100 1999/07/28, D. Tweed wrote: As for a math description of references, one could take the view that one always constructs objects a, with references r. Then what is indicated in the language is often the object pairs (a, r) modulo the equivalence relation that the references

Re: Again: Referential Equality

1999-07-28 Thread Fergus Henderson
Frank A. Christoph [EMAIL PROTECTED] wrote: Fergus wrote: If you put the call to `unsafePerformIO' in an unsafe primitive such as `req', then when your code is compiled with some optimizing compiler which assumes that functions are referentially transparent the resulting executable may

Re: Haskell 98

1999-07-28 Thread Fergus Henderson
On 13-Jul-1999, Sven Panne [EMAIL PROTECTED] wrote: And a last remark about arithmetic on file positions, as pointed out by Fergus(Hender)son: One has to be careful about CR/LF vs LF, but this is not a problem in the real world, There are lots of examples where this sort of things causes real

Re: Again: Referential Equality

1999-07-28 Thread D. Tweed
On Wed, 28 Jul 1999, Hans Aberg wrote: At 14:02 +0100 1999/07/28, D. Tweed wrote: As for a math description of references, one could take the view that one always constructs objects a, with references r. Then what is indicated in the language is often the object pairs (a, r) modulo the

Re: Again: Referential Equality

1999-07-28 Thread Lennart Augustsson
Fergus Henderson wrote: I'm not sure off-hand what the best fix would be. One possible solution would be to force evaluation of the arguments if they are equal: equal x y = unsafePerformIO $ do ptrEq - ptrEqual x y return (if ptrEq then x

Re: patches for adapting TclHaskell to Haskell98

1999-07-28 Thread Marcin 'Qrczak' Kowalczyk
Wed, 28 Jul 1999 22:31:41 +0400 (MSD), Grigoriy Strokin [EMAIL PROTECTED] pisze: - In TclPrims.g302.hs some functions looked like primInitTcl:: IO Bool primInitTcl = map int2bool (_ccall_ primInitTcl) I can't understand why (map int2bool) is applied to a non-list, neither

Re: Again: Referential Equality

1999-07-28 Thread Bart Demoen
Lennart Augustsson wrote: ... This is OK in Mercury because in Mercury ... Well, given that I think I'll stick to functional languages. ;-) I appreciate your ;-) Indeed, for lots of logic programmers, Mercury is a functional language in a logic syntax disguise. You can be a functional

Re: Again: Referential Equality

1999-07-28 Thread Hans Aberg
At 16:49 +0100 1999/07/28, D. Tweed wrote: ... I see now that you were describing how you could implement `language defined references' with semantics which mean that the problems that were pointed out don't happen. Right. I think that in a computer language one tends to think of the semantics

RE: Enjoy the silence

1999-07-28 Thread Frank A. Christoph
IIRC, this has already been discussed quickly some time ago, but anyway: To conform more with the rest of the *nix world and decrease the confusion of my students, I'd like GHC to be less verbose by default. IMHO the following messages should not be issued without any commandline flags: