G'day.

Quoting Joel Reymont <[EMAIL PROTECTED]>:

> 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

Good, but even better is this:

writeLoop :: (Event a -> IO ()) -> Handle -> (SSL, BIO, BIO) -> IO ()
writeLoop post h ssl
  = loop
  where
    loop = do handle (\e -> post $ NetworkError e) $
                do cmd <- read h ssl
                   post $! Cmd $! cmd
              loop

Avoiding parameter passing can make your code a lot easier to read.

Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to