Skip to content

Commit 56074fc

Browse files
committed
Make codec build on GHC 7.6.3.
1 parent 90d5485 commit 56074fc

7 files changed

Lines changed: 14 additions & 11 deletions

File tree

Control/Lens/Codec.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ import Data.Codec
1313
lensCodec :: (MonadReader s fr, MonadState s fw)
1414
=> (forall f. (a -> f a) -> s -> f s) -> Codec fr fw a
1515
lensCodec l = Codec
16-
{ parse = getConst <$> asks (l Const)
16+
{ parse = liftM getConst $ asks (l Const)
1717
, produce = \x -> modify (runIdentity . l (const $ Identity x))
18-
}
18+
}

Data/Binary/Bits/Codec.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module Data.Binary.Bits.Codec
66
)
77
where
88

9+
import Control.Applicative
910
import qualified Data.Binary.Bits.Get as G
1011
import Data.Binary.Bits.Put
1112
import qualified Data.Binary.Codec as B
@@ -33,4 +34,4 @@ word64be = Codec <$> G.word64be <*> putWord64be
3334
-- | Convert a `BitCodec` into a `B.BinaryCodec`.
3435
toBytes :: BitCodec a -> B.BinaryCodec a
3536
toBytes (Codec r w)
36-
= Codec (G.runBitGet $ G.block r) (runBitPut . w)
37+
= Codec (G.runBitGet $ G.block r) (runBitPut . w)

Data/Codec/Codec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Data.Codec.Codec
1313
)
1414
where
1515

16-
import Control.Applicative (Alternative(..), optional, Const(..))
16+
import Control.Applicative
1717
import Control.Monad ((>=>))
1818
import Control.Monad.Reader (ReaderT(..))
1919
import Data.Codec.Field

Data/Codec/Field.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module Data.Codec.Field
99
, having, build
1010
) where
1111

12+
import Control.Applicative
1213
import Control.Category
1314
import Prelude hiding ((.), id)
1415

Data/Codec/TH.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module Data.Codec.TH (genFields) where
22

3+
import Control.Applicative
34
import Data.Foldable (foldl')
4-
import Data.Traversable (for)
5+
import Data.Traversable (for, traverse)
56
import Language.Haskell.TH as TH
67
import Language.Haskell.TH.Syntax as TH
78

@@ -85,4 +86,4 @@ genFields n = reify n >>= \case
8586
let recType = foldl' (\t v -> AppT t (VarT v)) (ConT n) recVars
8687
cc = length cs
8788
concat <$> traverse (genCon recVars recType cc) cs
88-
_ -> fail "Unsupported record type."
89+
_ -> fail "Unsupported record type."

Data/Codec/Tuple.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ instance Field2 ( a, b ) b (a1 -> b -> ( a, b )) (a1 -> X -> ( a, b )) where
2020
f_2 = Field (\x c a1 _ -> c a1 x) snd
2121

2222
c_Left :: Con (Either a b) (a -> Either a b)
23-
c_Left = Con Left isLeft
23+
c_Left = Con Left (\case { Left _ -> True; _ -> False })
2424

2525
c_Right :: Con (Either a b) (b -> Either a b)
26-
c_Right = Con Right isRight
26+
c_Right = Con Right (\case { Right _ -> True; _ -> False })
2727

2828
f_left :: Field (Either a b) a (a -> Either a b) (X -> Either a b)
2929
f_left = Field (\x c _ -> c x) (\(Left l) -> l)
3030

3131
f_right :: Field (Either a b) b (b -> Either a b) (X -> Either a b)
32-
f_right = Field (\x c _ -> c x) (\(Right l) -> l)
32+
f_right = Field (\x c _ -> c x) (\(Right l) -> l)

codec.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ library
100100
FunctionalDependencies,
101101
DeriveFunctor,
102102
ScopedTypeVariables
103-
build-depends: base >=4.8,
103+
build-depends: base >=4.6,
104104
bytestring >=0.10,
105105
binary >=0.7,
106106
binary-bits >=0.5,
107-
template-haskell >=2.10,
107+
template-haskell >=2.8,
108108
mtl >= 2.2.1,
109109
aeson >= 0.8.0.2,
110110
text >= 1.2.0.4,

0 commit comments

Comments
 (0)