Hi nwn, I had the following error:
Run: Network/Socket/Internal.hsc:(298,2)-(314,60): Non-exhaustive patterns in case. The code for those lines look like this: > peekSockAddr p = do > family <- (#peek struct sockaddr, sa_family) p > case family :: CSaFamily of > #if defined(DOMAIN_SOCKET_SUPPORT) > (#const AF_UNIX) -> do > str <- peekCString ((#ptr struct sockaddr_un, sun_path) p) > return (SockAddrUnix str) > #endif > (#const AF_INET) -> do > addr <- (#peek struct sockaddr_in, sin_addr) p > port <- (#peek struct sockaddr_in, sin_port) p > return (SockAddrInet (PortNum port) addr) > #if defined(IPV6_SOCKET_SUPPORT) > (#const AF_INET6) -> do > port <- (#peek struct sockaddr_in6, sin6_port) p > flow <- (#peek struct sockaddr_in6, sin6_flowinfo) p > addr <- (#peek struct sockaddr_in6, sin6_addr) p > scope <- (#peek struct sockaddr_in6, sin6_scope_id) p > return (SockAddrInet6 (PortNum port) flow addr scope) > #endif Thanks for all your help. I'll first upgrade to a new GHC and then try again. -chris On 9 feb 2010, at 06:41, Yusaku Hashimoto wrote: > Try to reinstall HTTP package also. I think your HTTP package is still > linked with old broken network package. > > HTTP depends on network. And network is a binding for network API of > OS. These API is for C-language. When ghc builds such binding > packages, It runs gcc for some purpose. gcc thinks you need 64bit > binary (from SL, I believe.) and works for 64bit environment. But ghc > on Mac can only build 32bit binaries. So it causes the problem. > > You can check if network package was correctly built by running this. > This takes a host name, and gets the root document of the host via > HTTP using a socket. Build and try `./this_program haskell.org` > > import Network.Socket > import System.IO > import System.Environment > > getAddr :: HostName -> IO AddrInfo > getAddr host = head `fmap` > (getAddrInfo (Just defaultHints { addrSocketType = Stream }) > (Just host) > (Just "http")) > > connected :: HostName -> IO Socket > connected host = do > addrinfo <- getAddr host > sock <- socket (addrFamily addrinfo) > (addrSocketType addrinfo) > (addrProtocol addrinfo) > connect sock (addrAddress addrinfo) > return sock > > httpGet :: HostName -> IO String > httpGet host = do > h <- flip socketToHandle ReadWriteMode =<< connected host > hSetBuffering h NoBuffering > hPutStr h "GET / HTTP/1.0\r\n\r\n" > hGetContents h > > main = fmap head getArgs >>= httpGet >>= putStr > > I should have mentioned them in my last mail. Sorry. > > By the way, ghc-6.12 on Mac still can not build 64bit binaries. So > upgrading ghc won't solve it. > > --nwn > > On Mon, Feb 8, 2010 at 12:50 AM, Chris Eidhof <ch...@eidhof.nl> wrote: >> Thanks. Unfortunately, it didn't help. The thing that frustrates me is that >> it's quite hard to debug. I guess I'll upgrade my GHC to 6.12, hopefully >> that'll solve it. >> >> -chris >> >> On 7 feb 2010, at 16:07, Yusaku Hashimoto wrote: >> >>> Hello, >>> >>> On Sat, Feb 6, 2010 at 2:51 AM, Chris Eidhof <ch...@eidhof.nl> wrote: >>>> Approach 3: I used the simpleHTTP function from the HTTP package. This >>>> crashed, after I dug a little deeper into the code, it threw an error on >>>> calling the parseURI function (openFile: no such file exists). I installed >>>> the latest network package and upgraded my HTTP package, and the parseURI >>>> error went away. I felt like I was almost there, and tried the following: >>>> >>>>> simpleHTTP (getRequest "http://haskell.org") >>>> >>>> This failed with just the text "Bus error". I searched the HTTPBis git >>>> repository, but couldn't find the text "Bus error". I don't have a clue of >>>> how to fix this. >>> >>> Try reinstall network package with `cabal install --reinstall >>> --hsc2hs-options="--cflag=-m32 --lflag=-m32"`. >>> >>> See also: http://hackage.haskell.org/trac/ghc/ticket/3681 >>> >>> Hope this helps. >>> --nwn >> >> _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe