packages feed

encoding 0.6.4 → 0.6.5

raw patch · 4 files changed

+32/−31 lines, 4 files

Files

Data/Encoding/ByteSink.hs view
@@ -101,20 +101,15 @@     pushWord64be w = PutME $ Right (putWord64be w,())     pushWord64le w = PutME $ Right (putWord64le w,()) -#ifndef MIN_VERSION_mtl(2,0,0,0)+#if MIN_VERSION_base(4,3,0)+#else 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--instance ByteSink (State (Seq Char)) where-    pushWord8 x = modify (|> (chr $ fromIntegral x))--instance ByteSink (StateT (Seq Char) (Either EncodingException)) where+instance (Monad m,Throws EncodingException m) => ByteSink (StateT (Seq Char) m) where     pushWord8 x = modify (|> (chr $ fromIntegral x))  newtype StrictSink a = StrictS (Ptr Word8 -> Int -> Int -> IO (a,Ptr Word8,Int,Int))
Data/Encoding/ByteSource.hs view
@@ -103,10 +103,7 @@     fetchWord64be = getWord64be     fetchWord64le = getWord64le -instance Throws DecodingException (State [Char]) where-    throwException = throw--instance ByteSource (State [Char]) where+instance ByteSource (StateT [Char] Identity) where     sourceEmpty = gets null     fetchWord8 = do       chs <- get@@ -121,7 +118,8 @@       put chs       return res -#ifndef MIN_VERSION_mtl(2,0,0,0)+#if MIN_VERSION_base(4,3,0)+#else instance Monad (Either DecodingException) where     return = Right     (Left err) >>= g = Left err@@ -143,31 +141,17 @@       put chs       return res -instance Throws DecodingException (State BS.ByteString) where-    throwException = throw--instance ByteSource (State BS.ByteString) where+instance (Monad m,Throws DecodingException m) => ByteSource (StateT BS.ByteString m) where     sourceEmpty = gets BS.null-    fetchWord8 = State (\str -> case BS.uncons str of+    fetchWord8 = StateT (\str -> case BS.uncons str of                                   Nothing -> throw UnexpectedEnd-                                  Just (c,cs) -> (c,cs))+                                  Just (c,cs) -> return (c,cs))     fetchAhead act = do       str <- get       res <- act       put str       return res -instance ByteSource (StateT BS.ByteString (Either DecodingException)) where-    sourceEmpty = gets BS.null-    fetchWord8 = StateT (\str -> case BS.uncons str of-                                  Nothing -> Left UnexpectedEnd-                                  Just ns -> Right ns)-    fetchAhead act = do-      chs <- get-      res <- act-      put chs-      return res- instance ByteSource (StateT LBS.ByteString (Either DecodingException)) where     sourceEmpty = gets LBS.null     fetchWord8 = StateT (\str -> case LBS.uncons str of@@ -194,3 +178,20 @@       res <- act       liftIO $ hSetPosn pos       return res+    sourcePos = do+      h <- ask+      p <- liftIO $ hTell h+      return $ Just p++{-+instance Throws DecodingException (State st) => Throws DecodingException (State (Integer,st)) where+  throwException = throw++instance ByteSource (State st) => ByteSource (State (Integer,st)) where+  sourceEmpty = sourceEmpty+  fetchWord8 = do+    <- fetchWord8+  fetchAhead = fetchAhead+  sourcePos = do+    (p,chs) <- get+    return (Just p)-}
NEWS view
@@ -1,3 +1,8 @@+Changes from 0.6.4 to 0.6.5+---------------------------++* Make package work with >=base-4.3.0.0 and mtl-2+ Changes from 0.6.3 to 0.6.4 --------------------------- 
encoding.cabal view
@@ -1,5 +1,5 @@ Name:		encoding-Version:	0.6.4+Version:	0.6.5 Author:		Henning Günther Maintainer:	h.guenther@tu-bs.de License:	BSD3