Upon further investigation, it seems my problem is using HaXml 1.13.2 and HXT 8.3.0 in the same file. Furthermore I can't even import both HaXml and HXT because they each pull in different versions of 'network' which is causing the 'duplicate definition for symbol' problem. I can't think of a workaround - so I guess it's one or the other.

Also is there any reason the cabal installed version of HaXml 1.13.3 is so far behind the latest release 1.19.7? Is HXT, with a far more recent release, preferable overall?

thanks,
deech

On Wed, Jun 3, 2009 at 12:42 AM, aditya siram <aditya.siram@gmail.com> wrote:
Hi all,
I am trying to use HXT to parse an XML file. However whenever I try and run 'xread', GHCI crashes. The code and output are below.

The following code queries isbndb.com ( a book ISBN database ) which responds with XML describing the book. I am using 'xread' from HXT to parse the response into an XMLTree.

respHTML'' isbn = do
      rsp <- simpleHTTP (getRequest $ "http://isbndb.com/api/books.xml?results=details&access_key="
                                ++ key
                                ++ "&index1=isbn&value1="
                                ++ isbn :: Request_String)
      case rsp of
        Left x  -> putStrLn $ "Error " ++ (show x)
        Right r -> putStrLn $ show $ xread $ rspBody r

When I try this respHTML'' in GHCI usin the isbn for "Real World Haskell" , this is what I get:

*Main> respHTML'' rwhis
Loading package syb ... linking ... done.
Loading package base-3.0.3.1 ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package containers-0.2.0.1 ... linking ... done.
Loading package bytestring-0.9.1.4 ... linking ... done.
Loading package old-locale-1.0.0.1 ... linking ... done.
Loading package old-time-1.0.0.2 ... linking ... done.
Loading package unix-2.3.2.0 ... linking ... done.
Loading package filepath-1.1.0.2 ... linking ... done.
Loading package directory-1.0.0.3 ... linking ... done.
Loading package process-1.0.1.1 ... linking ... done.
Loading package pretty-1.0.1.0 ... linking ... done.
Loading package random-1.0.0.1 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package network-2.2.1 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package parallel-1.1.0.1 ... linking ... done.
Loading package HTTP-4000.0.6 ... linking ... done.
Loading package HaXml-1.13.3 ... linking ... done.
Loading package MaybeT-0.1.2 ... linking ... done.
Loading package HUnit-1.2.0.3 ... linking ... done.
Loading package curl-1.3.5 ... linking ... done.
Loading package network-2.2.1.2 ...

GHCi runtime linker: fatal error: I found a duplicate definition for symbol
   my_inet_ntoa
whilst processing object file
   /home/deech/.cabal/lib/network-2.2.1.2/ghc-6.10.3/HSnetwork-2.2.1.2.o
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.
GHCi cannot safely continue in this situation.  Exiting now.  Sorry.

It seems to want to load the 'network' package twice. Is this causing the trouble?

thanks ,
deech