Mutable Arrays

2000-05-09 Thread Marc van Dongen
Hello again, Sorry for asking again but I can't find the answer in the on line user manual. What does one have to do to use mutable arrays? An old program won't compile anymore with a very recent ghc from CVS. I am using GlaExts. Thanks in advance. Regards, Marc van Dongen -- Marc van

Re: Mutable Arrays

2000-05-09 Thread Michael Weber
On Tue, May 09, 2000 at 11:37:46 +0100, Marc van Dongen wrote: What does one have to do to use mutable arrays? An old program won't compile anymore with a very recent ghc from CVS. I am using GlaExts. $ cvs log ghc/lib/std/PrelArr.lhs revision 1.19 date: 2000/03/14 12:16:00; author:

Re: Mutable Arrays

2000-05-09 Thread Marc van Dongen
Michael Weber ([EMAIL PROTECTED]) wrote: [...] : $ cvs log ghc/lib/std/PrelArr.lhs : : revision 1.19 : date: 2000/03/14 12:16:00; author: simonmar; state: Exp; lines: +57 -57 : Simplfy the mutable array story: : - rename MutableArray to STArray (and similarly : for all

RE: strangeness with `Exception.tryAll'

2000-05-09 Thread Simon Marlow
tryAll (runST (return (error "BANG!"))) will return (Right (error "BANG!")), because return isn't strict. Nope, main = tryAll (runST (return (error "BANG!"::( = print yields `Left "BANG!"'! but main = tryAll (runST ( return ((error "BANG!",

RE: Showing tuples

2000-05-09 Thread Chris Angus
Do you derive Show for MyData? -Original Message- From: Mike Jones [mailto:[EMAIL PROTECTED]] Sent: 09 May 2000 05:58 To: [EMAIL PROTECTED] Subject: Showing tuples Hi, I am having trouble with Show and tuples. I have a data structure, say: data MyData = ... And a

Re: When is it safe to cheat?

2000-05-09 Thread Jan Skibinski
On Tue, 2 May 2000, Keith Wansbrough wrote: Off-topic, I know, but even if this worked as I think you intend, it would hardly be random and would certainly be unsuitable for use as a nonce. Applying `mkStdGen' to the current time doesn't make it any more random! You might as well use

Re: When is it safe to cheat?

2000-05-09 Thread Frank Atanassow
Jan Skibinski writes: Good point. Short of reading some truly random device (perhaps ambient temperature fluctuation) this can be always theoretically defeated. I can only make life more difficult to the attacker by trying to outsmart him algoritmically (Or to

Re: When is it safe to cheat?

2000-05-09 Thread Ketil Malde
Jan Skibinski [EMAIL PROTECTED] writes: Any good idea? First prize: a bottle of something good. :-) The easiest ought to simply have enough granularity in the gettimeofday() or equivalent. Sure you can guess the approximate time in hours or seconds, but can you guess it in micro- or

Re: When is it safe to cheat?

2000-05-09 Thread Jan Skibinski
On Tue, 9 May 2000, Frank Atanassow wrote: Jan Skibinski writes: Any good idea? First prize: a bottle of something good. :-) There is a thing known as an Entropy Gathering Demon (EGD). From http://www.lothar.com/tech/crypto/ : You have been nominated for the first prize,

RE: Showing tuples

2000-05-09 Thread Mike Jones
Chris, Yes, I do derive Show for MyData. I was surprised it did not work. Mike -Original Message- From: Chris Angus [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 09, 2000 12:57 AM To: 'Mike Jones'; [EMAIL PROTECTED] Subject: RE: Showing tuples Do you derive Show for MyData?

Re: Showing tuples

2000-05-09 Thread Sven Panne
Mike Jones wrote: Yes, I do derive Show for MyData. I was surprised it did not work. Deriving works, but GHC currently only contains instance declarations for tuples up to 5 elements, so you have to write you own boring instances for larger ones. *yawn* Cheers, Sven -- Sven Panne

RE: Showing tuples

2000-05-09 Thread Chris Angus
Mike ... try this ...extend it to however long tuples you have data MyData = Foo | Bar deriving Show main = print (Foo,Foo,Foo,Foo,Foo,Foo) instance (Show tv1, Show tv2, Show tv3, Show tv4, Show tv5 , Show tv6) = Show (tv1,tv2,tv3,tv4, tv5,tv6) where showsPrec p (v1,v2,v3,v4,v5,v6) =

Showing tuples

2000-05-09 Thread grust
Hi, I am having trouble with Show and tuples. I have a data structure, say: data MyData = ... And a value, say: value = (MyData..., MyData..., MyData) Then try to: show value I get a compiler message from ghc 4.05 that says: No instance for `Show (MyData, MyData, MyData)... What is

RE: Showing tuples

2000-05-09 Thread grust
Do you derive Show for MyData? -Original Message- From: Mike Jones [mailto:[EMAIL PROTECTED]] Sent: 09 May 2000 05:58 To: [EMAIL PROTECTED] Subject: Showing tuples Hi, I am having trouble with Show and tuples. I have a data structure, say: data MyData = ... And a

RE: Showing tuples

2000-05-09 Thread Mike Jones
Sven, That explains it. My tuples are of size 20. Thanks, Mike Deriving works, but GHC currently only contains instance declarations for tuples up to 5 elements, so you have to write you own boring instances for larger ones. *yawn* Cheers, Sven -- Sven Panne

Re: Converting float to double.

2000-05-09 Thread Marcin 'Qrczak' Kowalczyk
Mon, 8 May 2000 20:42:10 -0700 (PDT), Ronald J. Legere [EMAIL PROTECTED] pisze: I have a very simple question. What is the best way to convert a float to a double? I use fromRational.toRational, and the notes in the prelude seem to imply that this is optimized into something sensible..

Re: When is it safe to cheat?

2000-05-09 Thread Michael Hobbs
Jan Skibinski wrote: Any good idea? First prize: a bottle of something good. :-) In C, I've sometimes added in the memory location of an arbitrary variable, just for good measure. But that's not quite as secure in an open source environment. (Maybe not even that secure in a closed

Re: When is it safe to cheat?

2000-05-09 Thread Sverker Nilsson
Michael Hobbs wrote: I believe that the P3 chips come with a noisy diode built-in, specifically for the purpose of generating random numbers. You might try to find a way to access that little gizmo. (Assuming that you're running on a P3.) Interesting! Do you have any reference for this? I