On 11 Jan 2008, at 2:24 PM, Andre Nathan wrote:

processEntry :: DirStream -> IO ()
processEntry ds = do
  entry <- readDirStream ds
  if entry =~ "^[0-9]+$"
    then do
      putStrLn entry
      processEntry ds
    else
      if entry == "" then return () else processEntry ds

bar :: IO ()
bar = do
  ds <- openDirStream "."
  processEntry ds
  closeDirStream ds

This is a 200% increase in code size for a 75% decrease in execution time. (And, in general, the complexity can be much higher). That's an engineering tradeoff, and one you'll have to decide yourself; there's not much that can be done to make it go away.

jcc

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to