
Hi Manlio Manlio Perillo wrote:
By the way, I have managed to have a working program: http://hpaste.org/13919
I've made some some minor refinements according to my own tastes :-) http://hpaste.org/13919/diff?old=0&new=2 Please note that in both cases IO exceptions are not handled.
I would like to receive some advices: 1) I have avoided the do notation, using functions like liftM. Is this a good practice?
Avoinding the do notation is not good in itself. If it improves readability, is ok. But IMHO should not be used as a "smell" for bad coding style.
Is this as efficient as using do notation?
Note that the do notation is desugared by the compiler as one of the first steps. do print "foo" print "foo" is exactly equivalent to print "foo" >> print "foo" in terms of generated code
2) I have written some support functions: mapM' and filterM' Are they well written and generic?
mapM' is generic and already implemented: fmap (Note that a Monad is also a Functor) filterM' is specific enough not to deserve any package filterM' = fmap . map I replaced its use with a solution that I like more...
Are they already available in some package? Can you suggest better names? 3) I find (,) node `liftM` walkTree' path not very readable. Is it possible to express it in a more (not too much) verbose way?
I find it readable... It's ok IMO. You'll quickly be able to read that expressions without even thinking (sooner that what you may think)
Thanks Manlio Perillo
Paolo PS: Since I'm new to haskell as well, I hope you'll want to review _my_ code next turn ;-)