Re: [Haskell-cafe] Proper way to write this

2005-12-25 Thread Donn Cave
Quoth Pupeno <[EMAIL PROTECTED]>: | I have this piece of code: What do you think about this? may_ = maybe (return ()) (\ _ -> f) stopDaytimeServer dts = do may_ (killServer (ss dts)) (streamPort dts) may_ (killServer (ds dts)) (dgramPort dts) | PS: I have a worse case: I don't think it wil

Re: [Haskell-cafe] Proper way to write this

2005-12-25 Thread Lemmih
On 12/26/05, Pupeno <[EMAIL PROTECTED]> wrote: > I have this piece of code: > > stopDaytimeServer dts = > case dts of > DaytimeServer {streamPort = Just _, dgramPort = Just _} -> do > killServer (ss dts) > killServer (ds dts) > DaytimeServer {streamPort = Just _, dgramPort = N

[Haskell-cafe] Proper way to write this

2005-12-25 Thread Pupeno
I have this piece of code: stopDaytimeServer dts = case dts of DaytimeServer {streamPort = Just _, dgramPort = Just _} -> do killServer (ss dts) killServer (ds dts) DaytimeServer {streamPort = Just _, dgramPort = Nothing} -> do killServer (ss dts) DaytimeServer {str

RE: [Haskell-cafe] Haskell vs. Erlang for heavy-duty network apps (wasRe: Haskel

2005-12-25 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: Bulat Ziganshin <[EMAIL PROTECTED]> CC: Peter Simons <[EMAIL PROTECTED]>, haskell-cafe@haskell.org Subject: [Haskell-cafe] Haskell vs. Erlang for heavy-duty network apps (wasRe: Haskell Speed) Date: Sun, 25 Dec 2005 12:20:38 + On Dec 25, 2005,

[Haskell-cafe] Re: StringMap

2005-12-25 Thread jean-philippe bernardy
Christian Maeder tzi.de> writes: > > Hi, > > could I ask you for efficient StringMap implementations, i.e. based on > tries or hash keys? It's mainly for the sake of interest. In the (not > too distant) future I'd like to see a library module Data.MapString > along the lines of Data.Map and

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Lennart Augustsson
Branimir Maksimovic wrote: Great! what are constrains on [begin..end] could they be some type which supports (+) , but not Int. Anything in the Enum class (so it doesn't even have to support (+)). Many things are in the Enum class. Last question is: Does creation of list of functions humpers p

Re: [Haskell-cafe] Haskell vs. Erlang for heavy-duty network apps

2005-12-25 Thread Joel Reymont
On Dec 25, 2005, at 1:14 PM, Tomasz Zielonka wrote: I think your work will be very important and valuable for the community. You've shown were Haskell could be better, and I believe it will catch up eventually, either by improvements in GHC, in libraries or simply in documentation. Thank yo

Re: [Haskell-cafe] Haskell vs. Erlang for heavy-duty network apps (was Re: Haskell Speed)

2005-12-25 Thread Tomasz Zielonka
On Sun, Dec 25, 2005 at 12:20:38PM +, Joel Reymont wrote: > A disclaimer for those who might think that I'm a newbit > disillutioned with Haskell... I totally love Haskell, it just seems > that you need to be a guru to do what I'm trying to do and I have not > yet reached this status. I

[Haskell-cafe] Re: Haskell Speed

2005-12-25 Thread Peter Simons
Tomasz Zielonka writes: >> wc :: String -> (Int, Int, Int) >> wc file = ( length (lines file) >> , length (words file) >> , length file >> ) > > I have a crazy idea: what if we computed all three length > applications concurrently, with the RTS preempting the

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Glynn Clements
Branimir Maksimovic wrote: > >Could you give an example of a loop you find awkward in Haskell? > > Well I want simple loop for(int i =0;i<10;++i)doSomething(i); mapM_ doSomething [0..9] -- Glynn Clements <[EMAIL PROTECTED]> ___ Haskell-Cafe

[Haskell-cafe] Haskell vs. Erlang for heavy-duty network apps (was Re: Haskell Speed)

2005-12-25 Thread Joel Reymont
On Dec 25, 2005, at 10:13 AM, Bulat Ziganshin wrote: Hello Joel, [...] so i think that your problems is due to bad design decisions caused by lack of experience. two weeks ago when you skipped my suggestions about improving this design and answered that you will use "systematic approach", i for

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Daniel Carrera
Branimir Maksimovic wrote: Well I want simple loop for(int i =0;i<10;++i)doSomething(i); in haskell that would be for begin end f | begin /= end = do {f begin ; for (begin+1) end f} | otherwise = return () How about: result = [ doSomething(i) | i <- [0..9] ] I guess it depend

Re: [Haskell-cafe] Re: Haskell Speed

2005-12-25 Thread Tomasz Zielonka
On Sun, Dec 25, 2005 at 12:24:38PM +0100, Peter Simons wrote: > Paul Moore writes: > > > It would be interesting to see standalone code for wcIOB > > (where you're allowed to assume that any helpers you > > need, like your block IO library, are available from the > > standard library). This wo

[Haskell-cafe] Re: Haskell Speed

2005-12-25 Thread Peter Simons
Paul Moore writes: > It would be interesting to see standalone code for wcIOB > (where you're allowed to assume that any helpers you > need, like your block IO library, are available from the > standard library). This would help in comparing the > "obviousness" of the two approaches. A simpl

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Tomasz Zielonka
On Sun, Dec 25, 2005 at 11:09:51AM +, Branimir Maksimovic wrote: > >Or just 'mapM_ doSomething [1..10]' (: > > Neet! However would it be more efficient for, say, 1 million iterations? > Anyway I have to look for map functions. I'm learning step by step > from tutorials :) I remember I was imp

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Branimir Maksimovic
From: Lemmih <[EMAIL PROTECTED]> To: Branimir Maksimovic <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED], Haskell-Cafe@haskell.org Subject: Re: [Haskell-cafe] Haskell vs OCaml Date: Sun, 25 Dec 2005 11:43:56 +0100 On 12/25/05, Branimir Maksimovic <[EMAIL PROTECTED]> wrote: > > > > >From: Lennart Au

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Branimir Maksimovic
From: Matt Collins <[EMAIL PROTECTED]> To: "Branimir Maksimovic" <[EMAIL PROTECTED]> CC: Haskell-Cafe@haskell.org Subject: Re: [Haskell-cafe] Haskell vs OCaml Date: Sun, 25 Dec 2005 21:42:35 +1100 Perhaps something like for :: Int -> Int -> (Int -> IO ()) -> IO () for begin end f = sequence_

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Lemmih
On 12/25/05, Branimir Maksimovic <[EMAIL PROTECTED]> wrote: > > > > >From: Lennart Augustsson <[EMAIL PROTECTED]> > >To: Branimir Maksimovic <[EMAIL PROTECTED]> > >CC: [EMAIL PROTECTED], Haskell-Cafe@haskell.org > >Subject: Re: [Haskell-cafe] Haskell vs OCaml > >Date: Sun, 25 Dec 2005 10:25:44 +010

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Matt Collins
Perhaps something like for :: Int -> Int -> (Int -> IO ()) -> IO () for begin end f = sequence_ [ f i | i <- [begin..end] ] *Main> for 1 10 print 1 2 3 4 5 6 7 8 9 10 On 25/12/2005, at 9:35 PM, Branimir Maksimovic wrote: From: Lennart Augustsson <[EMAIL PROTECTED]> To: Branimir Maksimovi

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Branimir Maksimovic
From: Lennart Augustsson <[EMAIL PROTECTED]> To: Branimir Maksimovic <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED], Haskell-Cafe@haskell.org Subject: Re: [Haskell-cafe] Haskell vs OCaml Date: Sun, 25 Dec 2005 10:25:44 +0100 Branimir Maksimovic wrote: I've found that Haskell is pretty good in impl

Re[2]: [Haskell-cafe] Re: Haskell Speed

2005-12-25 Thread Bulat Ziganshin
Hello Joel, Saturday, December 24, 2005, 9:29:17 PM, you wrote: >> One of the interesting points that this illustrates (to me) is that >> the "obvious" approach in Haskell can be seriously non-optimal in >> terms of performance. Add to this the fact that tuning functional >> programs is a non-triv

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-25 Thread Lennart Augustsson
Branimir Maksimovic wrote: I've found that Haskell is pretty good in implementing recursive algorithms. Problem cames when one want's to implement non recursive algorithm by terms of recursion as Haskell does not support loops. Perhaps if we can get loops, situation will improve, but then that w