[Haskell-cafe] (Newbie Question) How to get the value of an IO String Monad?

2006-02-17 Thread Peter
Hello, For the purpose of familiarizing myself with Haskell, and also because I love Haskell :), I am trying to re-make a script that I made in Python that sends a request to a server and extracts the list of email addresses from a Mailman web-page by using an XML Parser on the page's HTML that

Re: [Haskell-cafe] (Newbie Question) How to get the value of an IO String Monad?

2006-02-17 Thread Marc Weber
You can access IO values only from within do blocks (see any tutorial, previous posts or google). It looks like this then: do= myvalue - functionwhichreturnsIOValue dosomethingwith myvalue Due to monads you don't have to leave the IO monad this way. Oh. Have to go now. do is translated into

Re: [Haskell-cafe] (Newbie Question) How to get the value of an IO String Monad?

2006-02-17 Thread Ketil Malde
Peter [EMAIL PROTECTED] writes: So, How am I supposed to get the value of an IO Monad, such as IO String, without returning an IO Monad? Short answer: you don't. IO is a one way street. Build your application top down in the IO monad (starting with 'main'), and bottom up with pure code,

Re: [Haskell-cafe] (Newbie Question) How to get the value of an IO String Monad?

2006-02-17 Thread Lemmih
On 2/17/06, Peter [EMAIL PROTECTED] wrote: Hello, For the purpose of familiarizing myself with Haskell, and also because I love Haskell :), I am trying to re-make a script that I made in Python that sends a request to a server and extracts the list of email addresses from a Mailman web-page

Re: [Haskell-cafe] (Newbie Question) How to get the value of an IO String Monad?

2006-02-17 Thread Daniel Fischer
Hi, Am Freitag, 17. Februar 2006 14:42 schrieb Peter: Hello, For the purpose of familiarizing myself with Haskell, and also because I love Haskell :), very good! I am trying to re-make a script that I made in Python that sends a request to a server and extracts the list of email addresses

Re: [Haskell-cafe] (Newbie Question) How to get the value of an IO String Monad?

2006-02-17 Thread Udo Stenzel
Peter wrote: So, How am I supposed to get the value of an IO Monad, such as IO String, without returning an IO Monad? You read correctly, this is impossible. You already got some valid answers, and here's another variant that preserves most of the nice guarded expressions: recv_headers' ::

Re: [Haskell-cafe] (Newbie Question) How to get the value of an IO String Monad?

2006-02-17 Thread Cale Gibbard
Hi, Apart from the other posts, you might also want to read http://www.haskell.org/hawiki/IntroductionToIO which is a quick intro to the way IO is handled in Haskell and http://www.haskell.org/hawiki/UsingIo which covers similar ground, but which also goes into a number of other common questions.