Re: [Haskell-cafe] Re: [Haskell] Re: Global Variables and =?utf-8?q?IO initializers?=

2004-11-08 Thread Keean Schupke
that can manage resources accross multiple programs)... What did you think of the code example given where the one-shot nature is provided by a 'C' wrapper around the FFI function. I think this is the best solution... Keean. Adrian Hey wrote: On Monday 08 Nov 2004 6:48 pm, Keean Schupke wrote

[Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

2004-11-07 Thread Keean Schupke
I might really want to call the initialisation twice. If you use global variables, the library can only be initialised once... but what if I really want to use the library twice? With the state in a type passed between functions, you can have multiple different states active at once. Keean.

Re: [Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

2004-11-07 Thread Keean Schupke
Adrian Hey wrote: Oh and while we're at it, perhaps one of you could explain what it is you think is unsafe about the hypothetical top level - bindings we're discussing (I've asked this before too, but no answer has been provided). Are your objections dogmatic, aesthetic, or rational? Do either of

Re: [Haskell-cafe] Set of reals...?

2004-10-30 Thread Keean Schupke
I would have thought it would have been sensible to base floating point maths on the IEEE spec, as thats what most hardware implements, and there are libraries to emulate it for everything else. Does haskell use IEEE primitives for things like sin/cos and sqrt? I am really surprised this area

Re: [Haskell-cafe] Set of reals...?

2004-10-28 Thread Keean Schupke
. stijn. On Wed, 27 Oct 2004 14:09:36 +0100, Keean Schupke [EMAIL PROTECTED] wrote: Well, its functional of course: union :: Interval - Interval - Interval union i j = Interval { isin x = isin i x || isin j x } intersection :: Interval - Interval - Interval intersection i j

Re: [Haskell-cafe] Set of reals...?

2004-10-27 Thread Keean Schupke
I think someone else mentioned using functions earlier, rather than a datatype why not define: data Interval = Interval { isin :: Float - Bool } Then each range becomes a function definition, for example: myInterval = Interval { isin r | r == 0.6 = True | r 0.7 r

Re: [Haskell-cafe] Set of reals...?

2004-10-27 Thread Keean Schupke
. On Wed, 27 Oct 2004 11:52:54 +0100, Keean Schupke [EMAIL PROTECTED] wrote: I think someone else mentioned using functions earlier, rather than a datatype why not define: data Interval = Interval { isin :: Float - Bool } Then each range becomes a function definition, for example: myInterval

Re: [Haskell-cafe] Re: Are handles garbage-collected?

2004-10-24 Thread Keean Schupke
The _result_ of a rather complex computation, so it has to return a function that returns the handle. for example: handleOpener = complex function bracket handleOpener close (\h - do Keean Peter Simons wrote: Remi Turk writes: Assuming I could _not_ use 'bracket', 'withFile', 'finally' or

<    1   2   3