diff --git a/README.md b/README.md index 63fbd06..a4bcbfa 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,16 @@ _Note:_ You will need the ICU Unicode library and it's header files in order to be able to build Pontarius XMPP. On Debian, you will need to install the *libicu-dev* package. In Fedora, the package is called *libicu-devel*. +_Note to GHC 7.0 users:_ You will need *cabal-install*, version *0.14.0* or +higher, or the build will fail with an "unrecognized option: +--disable-benchmarks" error. The versions *1.16.0* and higher might not build on +your system; if so, install *0.14.0* with "cabal install cabal-install-0.14.0". + +_Note to GHC 7.0.1 users:_ You will want to configure your Cabal environment +(including *cabal-install*) for *bytestring*, version *0.9.2.1*. We recommend +that you run "cabal install bytestring-0.9.2.1 cabal-install-0.14.0" prior to +installing Pontarius XMPP. + The first thing to do is to import the modules that we are going to use. We are also using the OverloadedStrings LANGUAGE pragma in order to be able to type Text values like strings. diff --git a/examples/echoclient/Main.hs b/examples/echoclient/Main.hs index 35b17ef..9f2730b 100644 --- a/examples/echoclient/Main.hs +++ b/examples/echoclient/Main.hs @@ -30,5 +30,5 @@ main = do forever $ do msg <- getMessage sess case answerMessage msg (messagePayload msg) of - Just answer -> sendMessage answer sess + Just answer -> sendMessage answer sess >> return () Nothing -> putStrLn "Received message with no sender." diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index 3322b92..f47d74b 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -1,6 +1,6 @@ Name: pontarius-xmpp Version: 0.2.0.1 -Cabal-Version: >= 1.6 +Cabal-Version: >= 1.4 Build-Type: Simple License: OtherLicense License-File: LICENSE.md @@ -16,7 +16,7 @@ Synopsis: An incomplete XMPP client implementation Description: Pontarius XMPP is a work in progress implementation of RFC 6120 ("XMPP CORE"), RFC 6121 ("XMPP IM"), and RFC 6122 ("XMPP ADDR"). Category: Network -Tested-With: GHC ==7.0.4, GHC ==7.4.1 +Tested-With: GHC >=7.0.1 && <=7.6.3 Extra-Source-Files: README.md , examples/echoclient/echoclient.cabal @@ -28,38 +28,78 @@ Extra-Source-Files: README.md Library hs-source-dirs: source Exposed: True - Build-Depends: attoparsec >=0.10.0.3 - , base >4 && <5 - , base64-bytestring >=0.1.0.0 - , binary >=0.4.1 - , bytestring >=0.9.1.9 - , conduit >=0.5 - , containers >=0.5.0.0 - , crypto-api >=0.9 - , crypto-random-api >=0.2 - , cryptohash >=0.6.1 - , cryptohash-cryptoapi >=0.1 - , data-default >=0.2 - , dns >=0.3.0 - , hslogger >=1.1.0 - , iproute >=1.2.4 - , lifted-base >=0.1.0.1 - , mtl >=2.0.0.0 - , network >=2.4.1.0 - , pureMD5 >=2.1.2.1 - , resourcet >=0.3.0 - , random >=1.0.0.0 - , split >=0.1.2.3 - , stm >=2.1.2.1 - , stringprep >=0.1.3 - , text >=0.11.1.5 - , tls >=1.1.0 - , tls-extra >=0.5.0 - , transformers >=0.2.2.0 - , void >=0.5.5 - , xml-types >=0.3.1 - , xml-conduit >=1.0 - , xml-picklers >=0.3.3 + -- The only different between the below two blocks is that the first one caps + -- the range for the `bytestring' package. + If impl(ghc == 7.0.1) + { + Build-Depends: attoparsec >=0.10.0.3 + , base >4 && <5 + , base64-bytestring >=0.1.0.0 + , binary >=0.4.1 + , bytestring >=0.9.1.9 && <=0.9.2.1 + , conduit >=0.5 + , containers >=0.5.0.0 + , crypto-api >=0.9 + , crypto-random-api >=0.2 + , cryptohash >=0.6.1 + , cryptohash-cryptoapi >=0.1 + , data-default >=0.2 + , dns >=0.3.0 + , hslogger >=1.1.0 + , iproute >=1.2.4 + , lifted-base >=0.1.0.1 + , mtl >=2.0.0.0 + , network >=2.4.1.0 + , pureMD5 >=2.1.2.1 + , resourcet >=0.3.0 + , random >=1.0.0.0 + , split >=0.1.2.3 + , stm >=2.1.2.1 + , stringprep >=0.1.3 + , text >=0.11.1.5 + , tls >=1.1.0 + , tls-extra >=0.5.0 + , transformers >=0.2.2.0 + , void >=0.5.5 + , xml-types >=0.3.1 + , xml-conduit >=1.0 + , xml-picklers >=0.3.3 + } + else + { + Build-Depends: attoparsec >=0.10.0.3 + , base >4 && <5 + , base64-bytestring >=0.1.0.0 + , binary >=0.4.1 + , bytestring >=0.9.1.9 + , conduit >=0.5 + , containers >=0.5.0.0 + , crypto-api >=0.9 + , crypto-random-api >=0.2 + , cryptohash >=0.6.1 + , cryptohash-cryptoapi >=0.1 + , data-default >=0.2 + , dns >=0.3.0 + , hslogger >=1.1.0 + , iproute >=1.2.4 + , lifted-base >=0.1.0.1 + , mtl >=2.0.0.0 + , network >=2.4.1.0 + , pureMD5 >=2.1.2.1 + , resourcet >=0.3.0 + , random >=1.0.0.0 + , split >=0.1.2.3 + , stm >=2.1.2.1 + , stringprep >=0.1.3 + , text >=0.11.1.5 + , tls >=1.1.0 + , tls-extra >=0.5.0 + , transformers >=0.2.2.0 + , void >=0.5.5 + , xml-types >=0.3.1 + , xml-conduit >=1.0 + , xml-picklers >=0.3.3 + } Exposed-modules: Network.Xmpp , Network.Xmpp.IM , Network.Xmpp.Internal diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs index d5460bb..c5901b0 100644 --- a/source/Network/Xmpp/Stream.hs +++ b/source/Network/Xmpp/Stream.hs @@ -39,7 +39,7 @@ import Network.DNS hiding (encode, lookup) import Network.Xmpp.Marshal import Network.Xmpp.Types import System.IO -import System.IO.Error (tryIOError) +-- import System.IO.Error (tryIOError) <- Only available in base >=4.4 import System.Log.Logger import System.Random (randomRIO) import Text.XML.Stream.Parse as XP @@ -821,3 +821,7 @@ withStream' action (Stream stream) = do mkStream :: StreamState -> IO Stream mkStream con = Stream `fmap` atomically (newTMVar con) + +-- "Borrowed" from base-4.4 for compatibility with GHC 7.0.1. +tryIOError :: IO a -> IO (Either IOError a) +tryIOError f = catch (f >>= \r -> return (Right r)) (return . Left)