Re: [Haskell-cafe] Code review: efficiency question

2006-05-03 Thread Brian Hulley
Bulat Ziganshin wrote: [ideas including reverseMapM_] you will laugh, but speed of your two solutions depends on so many factors (including size of CPU cache) that noone can say that is better in general. although for small lists reverseMapM_ should be faster than reverse+mapM. what will be

Re: [Haskell-cafe] Code review: efficiency question

2006-05-03 Thread Josef Svenningsson
Brian, You might also want to take a look at the list fusion functionality in GHC which often can help optimize your programs when programming with lists. http://www.haskell.org/ghc/docs/latest/html/users_guide/rewrite-rules.html#id3153234 It doesn't help in your particular program but it might

Re: [Haskell-cafe] Code review: efficiency question

2006-05-02 Thread Brian Hulley
Evan Martin wrote: I remember reading a tutorial that pointed out that you can often avoid explicit recusion in Haskell and instead use higher-level operators. For your code, I think drawModals = foldr (flip ()) (return ()) . map drawModal works(?). I think it would be foldl so that the

Re: [Haskell-cafe] Code review: efficiency question

2006-05-02 Thread Bulat Ziganshin
Hello Brian, Tuesday, May 2, 2006, 3:12:48 AM, you wrote: -- Prolog style coding... drawModals :: [Control] - ManagerM () drawModals [] = return () drawModals (c:cs) = do drawModals cs