[Haskell-beginners] A first try
manfred.lotz at arcor.de
Mon Jun 27 15:58:48 CEST 2011
On Mon, 27 Jun 2011 11:49:37 +0200
Daniel Fischer <daniel.is.fischer at googlemail.com> wrote:
> On Monday 27 June 2011, 11:15:13, Manfred Lotz wrote:
> > I tried now:
> > getXmlContent :: String -> Handle -> IO Ctan
> > getXmlContent xf inh = do
> > xml <- U.hGetContents inh
> > let content = xml `deepseq` parseXMLDoc xml
> > case content of
> > ...
> > deepseq really ensures parseXmlDoc gets the full file as a string.
> > It is unclear to me how this could be done without deepseq.
> To ensure that the entire file is read, you can seq on the length,
> xml <- U.hGetContents inh
> let content = parseXMLDoc xml
> length xml `seq` case content of ...
Thanks a lot for the suggestion. Works fine.
I only tried deepseq because my first try with seq
let content = xml `seq` parseXMLDoc xml
More information about the Beginners