Re: [Haskell-cafe] Request for comments - hdnsomatic
Hi I should release a new version - the darcs version requires haskell-src-exts 1.1.*. I'll do that tonight. Thanks, Neil 2009/8/17 Jesús Alberto Sánchez Pimienta jesusalbertosanc...@gmail.com: Many Thanks Neil, I tried to build hlint before submitting to the mail list but i couldn't because my haskell-src-exts is version 1.1.1 and the cabal file of hlint requires a version 1.1. Now i modified the cabal depends and successfully installed hlint, it's a great tool. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara 2009/8/16 Neil Mitchell ndmitch...@gmail.com Hi An easy way to get some instant feedback is to run HLint on it: http://community.haskell.org/~ndm/hlint The results are: C:\Neil\hlinthlint Example.hs Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines = return . map (second tail . break (== '=') . filter (/= ' ')) Why not: liftM (map (second tail . break (== '=') . filter (/= ' '))) (readFile p = return . lines) Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines Why not: liftM lines (readFile p) Found 2 suggestions So using liftM instead of = return might be better style. You can also make minor tweaks like: if null args then readConfig defaultConfig else readConfig (head args) == readConfig $ if null args then defaultConfig else head args currentIP - catch (getIPAddress webIP) (\e - syslog Error (show e) return 0) oldIP - catch (S.readFile ipCache) (\e - syslog Error (show e) return 0) == let catch_ x = catch x (\e - syslog Error (show e) return 0) currentIP - catch_ $ getIPAddress webIP oldIP - catch_ (S.readFile ipCache) And there's no need to exitSuccess at the end of main, exitSuccess is the default. Thanks Neil 2009/8/16 Jesús Alberto Sánchez Pimienta jesusalbertosanc...@gmail.com: Hello haskellers, I just finished my first useful haskell program and I'd be glad if you make me some comments http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8244#a8244 Thank you, and sorry for my english. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Request for comments - hdnsomatic
Hello haskellers, I just finished my first useful haskell program and I'd be glad if you make me some comments http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8244#a8244 Thank you, and sorry for my english. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Request for comments - hdnsomatic
Hi An easy way to get some instant feedback is to run HLint on it: http://community.haskell.org/~ndm/hlint The results are: C:\Neil\hlinthlint Example.hs Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines = return . map (second tail . break (== '=') . filter (/= ' ')) Why not: liftM (map (second tail . break (== '=') . filter (/= ' '))) (readFile p = return . lines) Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines Why not: liftM lines (readFile p) Found 2 suggestions So using liftM instead of = return might be better style. You can also make minor tweaks like: if null args then readConfig defaultConfig else readConfig (head args) == readConfig $ if null args then defaultConfig else head args currentIP - catch (getIPAddress webIP) (\e - syslog Error (show e) return 0) oldIP - catch (S.readFile ipCache) (\e - syslog Error (show e) return 0) == let catch_ x = catch x (\e - syslog Error (show e) return 0) currentIP - catch_ $ getIPAddress webIP oldIP - catch_ (S.readFile ipCache) And there's no need to exitSuccess at the end of main, exitSuccess is the default. Thanks Neil 2009/8/16 Jesús Alberto Sánchez Pimienta jesusalbertosanc...@gmail.com: Hello haskellers, I just finished my first useful haskell program and I'd be glad if you make me some comments http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8244#a8244 Thank you, and sorry for my english. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Request for comments - hdnsomatic
Many Thanks Neil, I tried to build hlint before submitting to the mail list but i couldn't because my haskell-src-exts is version 1.1.1 and the cabal file of hlint requires a version 1.1. Now i modified the cabal depends and successfully installed hlint, it's a great tool. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara 2009/8/16 Neil Mitchell ndmitch...@gmail.com Hi An easy way to get some instant feedback is to run HLint on it: http://community.haskell.org/~ndm/hlinthttp://community.haskell.org/%7Endm/hlint The results are: C:\Neil\hlinthlint Example.hs Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines = return . map (second tail . break (== '=') . filter (/= ' ')) Why not: liftM (map (second tail . break (== '=') . filter (/= ' '))) (readFile p = return . lines) Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines Why not: liftM lines (readFile p) Found 2 suggestions So using liftM instead of = return might be better style. You can also make minor tweaks like: if null args then readConfig defaultConfig else readConfig (head args) == readConfig $ if null args then defaultConfig else head args currentIP - catch (getIPAddress webIP) (\e - syslog Error (show e) return 0) oldIP - catch (S.readFile ipCache) (\e - syslog Error (show e) return 0) == let catch_ x = catch x (\e - syslog Error (show e) return 0) currentIP - catch_ $ getIPAddress webIP oldIP - catch_ (S.readFile ipCache) And there's no need to exitSuccess at the end of main, exitSuccess is the default. Thanks Neil 2009/8/16 Jesús Alberto Sánchez Pimienta jesusalbertosanc...@gmail.com: Hello haskellers, I just finished my first useful haskell program and I'd be glad if you make me some comments http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8244#a8244 Thank you, and sorry for my english. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe