Browse Source

Disable TH for GHC <7.6

When `template-haskell' has been built against `containers' <0.5 (as is the case
with GHC <7.6), building Pontarius XMPP (that requires `containers' >= 0.5) will
force a rebuild of `template-haskell'. This seems to break GHC (and might likely
also break `template-haskell').
master
Jon Kristensen 13 years ago
parent
commit
adedc3079a
  1. 45
      pontarius-xmpp.cabal
  2. 4
      source/Network/Xmpp.hs
  3. 13
      source/Network/Xmpp/Types.hs

45
pontarius-xmpp.cabal

@ -28,8 +28,10 @@ Extra-Source-Files: README.md
Library Library
hs-source-dirs: source hs-source-dirs: source
Exposed: True Exposed: True
-- The only different between the below two blocks is that the first one caps -- The only different between the below two blocks is that the first one caps
-- the range for the `bytestring' package. -- the range for the `bytestring' package, and that the second one includes
-- `template-haskell' for GHC 7.6.1 and above.
If impl(ghc ==7.0.1) If impl(ghc ==7.0.1)
{ {
Build-Depends: attoparsec >=0.10.0.3 Build-Depends: attoparsec >=0.10.0.3
@ -56,7 +58,6 @@ Library
, split >=0.1.2.3 , split >=0.1.2.3
, stm >=2.1.2.1 , stm >=2.1.2.1
, stringprep >=0.1.3 , stringprep >=0.1.3
, template-haskell >=2.5
, text >=0.11.1.5 , text >=0.11.1.5
, tls >=1.1.0 , tls >=1.1.0
, tls-extra >=0.5.0 , tls-extra >=0.5.0
@ -66,7 +67,9 @@ Library
, xml-conduit >=1.0 , xml-conduit >=1.0
, xml-picklers >=0.3.3 , xml-picklers >=0.3.3
} }
else Else
{
If impl(ghc >=7.6.1)
{ {
Build-Depends: attoparsec >=0.10.0.3 Build-Depends: attoparsec >=0.10.0.3
, base >4 && <5 , base >4 && <5
@ -102,6 +105,42 @@ Library
, xml-conduit >=1.0 , xml-conduit >=1.0
, xml-picklers >=0.3.3 , 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 Exposed-modules: Network.Xmpp
, Network.Xmpp.IM , Network.Xmpp.IM
, Network.Xmpp.Internal , Network.Xmpp.Internal

4
source/Network/Xmpp.hs

@ -21,7 +21,7 @@
-- For low-level access to Pontarius XMPP, see the "Network.Xmpp.Internal" -- For low-level access to Pontarius XMPP, see the "Network.Xmpp.Internal"
-- module. -- module.
{-# LANGUAGE NoMonomorphismRestriction, OverloadedStrings #-} {-# LANGUAGE CPP, NoMonomorphismRestriction, OverloadedStrings #-}
module Network.Xmpp module Network.Xmpp
( -- * Session management ( -- * Session management
@ -46,7 +46,9 @@ module Network.Xmpp
-- for addressing entities in the network. It is somewhat similar to an e-mail -- for addressing entities in the network. It is somewhat similar to an e-mail
-- address, but contains three parts instead of two. -- address, but contains three parts instead of two.
, Jid , Jid
#if __GLASGOW_HASKELL >= 706
, jidQ , jidQ
#endif
, isBare , isBare
, isFull , isFull
, jidFromText , jidFromText

13
source/Network/Xmpp/Types.hs

@ -1,6 +1,11 @@
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL >= 706
{-# LANGUAGE TemplateHaskell #-}
#endif
{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TupleSections #-} {-# LANGUAGE TupleSections #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE StandaloneDeriving #-}
@ -44,7 +49,9 @@ module Network.Xmpp.Types
, StreamConfiguration(..) , StreamConfiguration(..)
, langTag , langTag
, Jid(..) , Jid(..)
#if __GLASGOW_HASKELL >= 706
, jidQ , jidQ
#endif
, isBare , isBare
, isFull , isFull
, jidFromText , jidFromText
@ -78,8 +85,10 @@ import Data.Text (Text)
import qualified Data.Text as Text import qualified Data.Text as Text
import Data.Typeable(Typeable) import Data.Typeable(Typeable)
import Data.XML.Types import Data.XML.Types
#if __GLASGOW_HASKELL >= 706
import Language.Haskell.TH import Language.Haskell.TH
import Language.Haskell.TH.Quote import Language.Haskell.TH.Quote
#endif
import Network import Network
import Network.DNS import Network.DNS
import Network.TLS hiding (Version) import Network.TLS hiding (Version)
@ -962,6 +971,7 @@ instance Read Jid where
[(parseJid (read s' :: String), r)] -- May fail with "Prelude.read: no parse" [(parseJid (read s' :: String), r)] -- May fail with "Prelude.read: no parse"
-- or the `parseJid' error message (see below) -- or the `parseJid' error message (see below)
#if __GLASGOW_HASKELL >= 706
jidQ :: QuasiQuoter jidQ :: QuasiQuoter
jidQ = QuasiQuoter { quoteExp = \s -> do jidQ = QuasiQuoter { quoteExp = \s -> do
when (head s == ' ') . fail $ "Leading whitespaces in JID" ++ show s when (head s == ' ') . fail $ "Leading whitespaces in JID" ++ show s
@ -981,6 +991,7 @@ jidQ = QuasiQuoter { quoteExp = \s -> do
textE t = [| Text.pack $(stringE $ Text.unpack t) |] textE t = [| Text.pack $(stringE $ Text.unpack t) |]
mbTextE Nothing = [| Nothing |] mbTextE Nothing = [| Nothing |]
mbTextE (Just s) = [| Just $(textE s) |] mbTextE (Just s) = [| Just $(textE s) |]
#endif
-- | Parses a JID string. -- | Parses a JID string.
-- --

Loading…
Cancel
Save