On Tue, Apr 14, 2009 at 8:54 AM, rodrigo.bonifacio <rodrigo.bonifacio@uol.com.br> wrote:
Dear Sirs,
I guess this is a very simple question. How can I convert IO [XmlTree] to just a list of XmlTree?
This is very important: you cannot.
But you can still get your hands on one inside a do block. As in, if you have tree :: IO [XmlTree], then you can say, eg.
printTree = do
t <- tree
print t
Inside this block, t is an [XmlTree], and it is passed to print. Intutively, when you see
x <- y
inside a do block, if y :: IO a, for some type a, then x :: a.
But there is no function that will get you from IO [XmlTree] -> [XmlTree], you have to use binding like this.
Luke