Hi Radosław, You should be able to write this with MaybeT as follows:
getStrip :: IO ( Maybe String ) getStrip = runMaybeT $ do pageContent <- liftIO $ downloadFile mainPageAddress let x = patternForStrip pageContent print x z <- x liftIO $ downloadFile $ mainPageAddress ++ z If you can do without the 'print', you should be able to write it as: getStrip :: IO ( Maybe String ) getStrip = runMaybeT $ do pageContent <- liftIO $ downloadFile mainPageAddress z <- patternForStrip pageContent liftIO $ downloadFile $ mainPageAddress ++ z You can find MaybeT here: http://www.haskell.org/haskellwiki/New_monads/MaybeT Best, - Benja On 11/18/07, Radosław Grzanka <[EMAIL PROTECTED]> wrote: > Hello, > I am writing some toys programs to learn and try to apply Monads > properties (without success, I must say). Although I spent half a day > on this code: > > http://hpaste.org/3957 > > I couldn't simplify (shorten) getStrip function. After reading "Doing > it with class" ( > http://www.haskell.org/all_about_monads/html/class.html ) I had an > impression that I could "collapse" cases using some Monads properties. > But maybe I misunderstood something. > > Can anyone look at it and give me a pointers?? (I don't mind if the > code becomes unreadable a bit.) > > Thank you, > Radek. > _______________________________________________ > 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