From 9a7f52ab7a23ef22120a58299a6e6fe78079c21a Mon Sep 17 00:00:00 2001 From: Henning Guenther Date: Sun, 3 Apr 2011 05:38:36 -0700 Subject: [PATCH] Fix compilation with mtl-2 Ignore-this: 867097705abf2d63e427858078720dc4 This took really long, sorry everybody :/ darcs-hash:20110403123836-a4fee-c6af95e58267ca7e215e24bee250d0bbae13a1d4 --- Data/Encoding/ByteSink.hs | 4 +++- Data/Encoding/ByteSource.hs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Data/Encoding/ByteSink.hs b/Data/Encoding/ByteSink.hs index 551fa24..09f76ae 100644 --- a/Data/Encoding/ByteSink.hs +++ b/Data/Encoding/ByteSink.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE FlexibleInstances,FlexibleContexts,MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances,FlexibleContexts,MultiParamTypeClasses,CPP #-} module Data.Encoding.ByteSink where import Data.Encoding.Exception @@ -101,10 +101,12 @@ instance ByteSink PutME where pushWord64be w = PutME $ Right (putWord64be w,()) pushWord64le w = PutME $ Right (putWord64le w,()) +#ifndef MIN_VERSION_mtl(2,0,0,0) instance Monad (Either EncodingException) where return x = Right x Left err >>= g = Left err Right x >>= g = g x +#endif instance Throws EncodingException (State (Seq Char)) where throwException = throw diff --git a/Data/Encoding/ByteSource.hs b/Data/Encoding/ByteSource.hs index 2b1bdb5..09d1676 100644 --- a/Data/Encoding/ByteSource.hs +++ b/Data/Encoding/ByteSource.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE FlexibleInstances,FlexibleContexts,MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances,FlexibleContexts,MultiParamTypeClasses,CPP #-} module Data.Encoding.ByteSource where import Data.Encoding.Exception @@ -121,10 +121,12 @@ instance ByteSource (State [Char]) where put chs return res +#ifndef MIN_VERSION_mtl(2,0,0,0) instance Monad (Either DecodingException) where return = Right (Left err) >>= g = Left err (Right x) >>= g = g x +#endif instance ByteSource (StateT [Char] (Either DecodingException)) where sourceEmpty = gets null