Hi Benja, > Something like the following might feel cleaner, though: > > maybeT :: Maybe a -> MaybeT m a > maybeT = MaybeT . return > > downloadFile :: String -> MaybeT IO String > downloadFile s = maybeT (parseURI s) >>= liftIO . httpGet
This is even neater. However, I fail to implement this. It does not compile and although I spent few hours trying to figure out correct usage of transformers I still fail to solve this. Here are types of expressions parseURI :: String -> Maybe URI httpGet :: URI -> IO (Maybe String) maybeT parseURI :: (Monad m) => String -> MaybeT m Network.URI.URI So far so good. However: liftIO . httpGet :: (Control.Monad.Trans.MonadIO m) => Network.URI.URI -> m (Maybe String) so it gives different type than is required here because httpGet already returns IO Maybe String. So I would need transformation from IO ( Maybe a) -> MaybeT IO a . Is there such possibility? Thank you for your spent time on this. Cheers, Radek. -- Codeside: http://codeside.org/ Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe