Skip to content

Commit 9dac7f4

Browse files
authored
Merge pull request #142 from andreasabel/mtl-2.3-rc3
Build with mtl-2.3-rc3 & drop flag mtl1
2 parents 3e9af54 + 89ccc75 commit 9dac7f4

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

HTTP.cabal

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ Source-Repository head
6666
type: git
6767
location: https://github.com/haskell/HTTP.git
6868

69-
Flag mtl1
70-
description: Use the old mtl version 1.
71-
default: False
72-
7369
Flag warn-as-error
7470
default: False
7571
description: Build with warnings-as-errors
@@ -114,25 +110,21 @@ Library
114110
-- note the test harness constraints should be kept in sync with these
115111
-- where dependencies are shared
116112
build-depends:
117-
base >= 4.6.0.0 && < 4.17
118-
, array >= 0.3.0.2 && < 0.6
119-
, bytestring >= 0.9.1.5 && < 0.12
120-
, parsec >= 2.0 && < 3.2
121-
, time >= 1.1.2.3 && < 1.13
113+
base >= 4.6.0.0 && < 4.17
114+
, array >= 0.3.0.2 && < 0.6
115+
, bytestring >= 0.9.1.5 && < 0.12
116+
, parsec >= 2.0 && < 3.2
117+
, time >= 1.1.2.3 && < 1.13
118+
, transformers >= 0.2.0.0 && < 0.7
119+
-- transformers-0.2.0.0 is the first to have Control.Monad.IO.Class
122120
-- The following dependencies are refined by flags, but they should
123121
-- still be mentioned here on the top-level.
124-
, mtl >= 1.1.1.0 && < 2.3
125-
, network >= 2.4 && < 3.2
122+
, mtl >= 2.0.0.0 && < 2.3
123+
, network >= 2.4 && < 3.2
126124

127125
default-language: Haskell98
128126
default-extensions: FlexibleInstances
129127

130-
if flag(mtl1)
131-
Build-depends: mtl < 1.2
132-
CPP-Options: -DMTL1
133-
else
134-
Build-depends: mtl >= 2.0
135-
136128
if flag(network-uri)
137129
Build-depends: network-uri == 2.6.*, network >= 2.6
138130
else

Network/Browser.hs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,14 @@ import Control.Monad.Fail
140140
import Data.Char (toLower)
141141
import Data.List (isPrefixOf)
142142
import Data.Maybe (fromMaybe, listToMaybe, catMaybes )
143+
#if !MIN_VERSION_base(4,8,0)
143144
import Control.Applicative (Applicative (..), (<$>))
144-
#ifdef MTL1
145-
import Control.Monad (filterM, forM_, when, ap)
146-
#else
147-
import Control.Monad (filterM, forM_, when)
148145
#endif
149-
import Control.Monad.State (StateT (..), MonadIO (..), modify, gets, withStateT, evalStateT, MonadState (..))
146+
import Control.Monad (filterM, forM_, when)
147+
import Control.Monad.IO.Class
148+
( MonadIO (..) )
149+
import Control.Monad.State
150+
( MonadState(..), gets, modify, StateT (..), evalStateT, withStateT )
150151

151152
import qualified System.IO
152153
( hSetBuffering, hPutStr, stdout, stdin, hGetChar
@@ -418,20 +419,12 @@ instance Show (BrowserState t) where
418419
-- | @BrowserAction@ is the IO monad, but carrying along a 'BrowserState'.
419420
newtype BrowserAction conn a
420421
= BA { unBA :: StateT (BrowserState conn) IO a }
421-
#ifdef MTL1
422-
deriving (Functor, Monad, MonadIO, MonadState (BrowserState conn))
423-
424-
instance Applicative (BrowserAction conn) where
425-
pure = return
426-
(<*>) = ap
427-
#else
428422
deriving
429423
( Functor, Applicative, Monad, MonadIO, MonadState (BrowserState conn)
430424
#if MIN_VERSION_base(4,9,0)
431425
, MonadFail
432426
#endif
433427
)
434-
#endif
435428

436429
runBA :: BrowserState conn -> BrowserAction conn a -> IO a
437430
runBA bs = flip evalStateT bs . unBA

0 commit comments

Comments
 (0)