
10 Dec
2005
10 Dec
'05
3:41 p.m.
I always wandered, does ghc do tail-call optimization? Would it optimize the two variants of the function below or just the first one? --- Proper? writeLoop :: (Event a -> IO ()) -> Handle -> (SSL, BIO, BIO) -> IO () writeLoop post h ssl = do handle (\e -> post $ NetworkError e) $ do cmd <- read h ssl post $! Cmd $! cmd writeLoop post h ssl --- Bad? writeLoop :: (Event a -> IO ()) -> Handle -> (SSL, BIO, BIO) -> IO () writeLoop post h ssl = do handle (\e -> post $ NetworkError e) $ do cmd <- read h ssl post $! Cmd $! cmd writeLoop post h ssl Thanks, Joel -- http://wagerlabs.com/