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

2004-10-28 Thread Keean Schupke
erm, yes you're right - don't know why that is - seems a fairly arbitrary decision to me... perhaps someone else knows a good reason why normal function definiton is not allowed? Stijn De Saeger wrote: aha, I see. Seems like i still have a long way to go with functional programming. final questi

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

2004-10-28 Thread Keean Schupke
Subsets can be done like this: myInterval = Interval { isin = \n -> case n of r | r == 0.3 -> True | r > 0.6 && r < 1.0 -> True | otherwise -> False, rangein = \(s,e) -> case (s,e) of (i,j) | i==0.3 && j==0.3 -> True | i>=0.6 && j<=1.0 -> True |

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

2004-10-28 Thread Ketil Malde
Stijn De Saeger <[EMAIL PROTECTED]> writes: > But, like you mentioned in your post, now I find myself needing a > notion of subset relations, and since you obviously can't define > equality over functions, i'm stuck again. Perhaps one can define an approximate equality, with an error bound? Def

[Haskell-cafe] intToWord32

2004-10-28 Thread John Velman
I'm trying to test TclHaskell under Hugs98-Nov2003, compiled from source. My current problem with getting it to work seems to be a failure to load the function intToWord32. Well, here is a partial transcript of a session run from within the TclHaskell src directory (after compiling TclPrim.so):

Re: [Haskell-cafe] intToWord32

2004-10-28 Thread Sven Panne
John Velman wrote: I'm trying to test TclHaskell under Hugs98-Nov2003, compiled from source. My current problem with getting it to work seems to be a failure to load the function intToWord32. "intToWord32" and friends have been deprecated more than 3 years ago, and recent Haskell platforms have dro

[Haskell-cafe] hugs segmentation fault

2004-10-28 Thread Andrej Bauer
Hi, I am new to haskell, but otherwise experienced in programming languages. My first attempt at Haskell was this (on a Linux Debian) session with hugs: Type :? for help Prelude> :version -- Hugs Version November 2003 Prelude> let p = 1 : [2 * x | x <- p, x < 1] in p [1Segmentation fault Is it

Re: [Haskell-cafe] hugs segmentation fault

2004-10-28 Thread Jon Fairbairn
On 2004-10-29 at 00:45+0200 Andrej Bauer wrote: > Hi, > > I am new to haskell, but otherwise experienced in programming languages. > My first attempt at Haskell was this (on a Linux Debian) session with hugs: > > Type :? for help > Prelude> :version > -- Hugs Version November 2003 > Prelude> let

Re: [Haskell-cafe] hugs segmentation fault

2004-10-28 Thread Ben Rudiak-Gould
Jon Fairbairn wrote: >In ghci you get: > >[1*** Exception: <> > >which is better. Not much better, though: in my experience this particular exception leaves ghci in a very peculiar state, and it's usually necessary to quit and restart it before it will work again. Is it coincidence that both Hug

Re: [Haskell-cafe] hugs segmentation fault

2004-10-28 Thread Jon Fairbairn
On 2004-10-29 at 00:03BST Ben Rudiak-Gould wrote: > Jon Fairbairn wrote: > > >In ghci you get: > > > >[1*** Exception: <> > > > >which is better. > > Not much better, though: in my experience this particular > exception leaves ghci in a very peculiar state, and it's > usually necessary to qu

Re: [Haskell-cafe] hugs segmentation fault

2004-10-28 Thread Ben Rudiak-Gould
Jon Fairbairn wrote: >On 2004-10-29 at 00:03BST Ben Rudiak-Gould wrote: > >>Not much better, though: in my experience this particular >>exception leaves ghci in a very peculiar state, and it's >>usually necessary to quit and restart it before it will >>work again. > >I don't think I've seen such a

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

2004-10-28 Thread Conal Elliott
Thanks for the explanation and example. I think the goal is to close the pipe (for instance) asap after writing is finished. GC imposes a delay, but so does bracketing, especially where modularity is desired. Consider that the bracketing IO code calls separately defined IO code, which makes the f

Re: [Haskell-cafe] hugs segmentation fault

2004-10-28 Thread Fergus Henderson
On 29-Oct-2004, Ben Rudiak-Gould <[EMAIL PROTECTED]> wrote: > Jon Fairbairn wrote: > > >On 2004-10-29 at 00:03BST Ben Rudiak-Gould wrote: > > > >>Not much better, though: in my experience this particular > >>exception leaves ghci in a very peculiar state, and it's > >>usually necessary to quit and

[Haskell-cafe] Calling Haskell from .Net Environment

2004-10-28 Thread David Lo
Dear all, I'm new in Haskell. I need to port a haskell application written by someone else to be called by a .Net C# application. Please kindly advise on which option to pursue. Any helps will really be appreciated. Best Regards, David ___ Haskell-Cafe

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

2004-10-28 Thread Stijn De Saeger
Hi again, yes, i decided to go with my first idea after all and represent real-valued sets as a list of ranges. It went pretty ok for a while, but then inevitably new questions come up... *sigh*. i'll get this to work eventually... maybe. :-) for anyone still interested in the topic, here's where

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

2004-10-28 Thread Glynn Clements
Stijn De Saeger wrote: > Now, for unions I tried the following: > to take the union of two BasicSets, just append them and contract the result. > contracting meaning: merge overlapping intervals. > > > contract :: Range -> Range -> BasicSet > > contract (x1,y1) (x2,y2) > > | x2 <= y1 = if x2