packages feed

iteratee-parsec 0.0.4 → 0.0.5

raw patch · 3 files changed

+44/−28 lines, 3 filesdep ~iterateePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: iteratee

API changes (from Hackage documentation)

Files

iteratee-parsec.cabal view
@@ -1,20 +1,20 @@ Name:                     iteratee-parsec-Version:                  0.0.4+Version:                  0.0.5 Synopsis:                 Package allowing parsec parser initeratee Description:              Package providing instances of Stream in                           Iteratee monad. Category:                 Data, Parsing License:                  MIT-License-file:	          LICENSE-Author:		          John Lato,+License-file:             LICENSE+Author:                   John Lato,                           Maciej Piechotka-Maintainer:	          uzytkownik2@gmail.com-Build-Type:	          Simple-Cabal-Version:	          >=1.4+Maintainer:               uzytkownik2@gmail.com+Build-Type:               Simple+Cabal-Version:            >=1.4  Library   Build-Depends:          base >= 3 && < 5,-                          iteratee >= 0.4 && < 0.5,+                          iteratee >= 0.4 && < 0.7,                           ListLike >= 1.0 && < 2,                           parsec >= 3.1 && < 3.2,                           transformers >= 0.2.0.0 && < 0.3@@ -26,4 +26,4 @@                           FlexibleInstances,                           MultiParamTypeClasses,                           UndecidableInstances-  GHC-Options:		  -Wall+  GHC-Options:            -Wall
src/Text/Parsec/Iteratee/Chunk.hs view
@@ -23,10 +23,12 @@ where  import Control.Applicative+import Control.Exception import Control.Monad import Data.Iteratee as I import qualified Data.ListLike as LL import Data.Monoid+import Data.Typeable import Text.Parsec hiding (Stream) import qualified Text.Parsec as P @@ -64,7 +66,9 @@               | n < LL.length xs = idone (Just $ LL.index xs n) c               | otherwise = liftI (nextChunk xs)           step (EOF Nothing) = return Nothing-          step (EOF (Just err)) = throwErr err+          step (EOF (Just se@(SomeException e)))+              | typeOf e == seekType = throwErr $ unhandled e+              | otherwise = throwRecoverableErr se step                      nextChunk xs (Chunk xs')               | LL.null xs' = liftI (nextChunk xs)@@ -72,4 +76,10 @@               | otherwise = liftI (nextChunk nxs)               where nxs = xs `mappend` xs'           nextChunk xs (EOF Nothing) = idone Nothing (Chunk xs)-          nextChunk _ (EOF (Just err)) = throwErr err+          nextChunk xs (EOF (Just se@(SomeException e)))+              | typeOf e == seekType = throwErr $ unhandled e+              | otherwise = throwRecoverableErr se (nextChunk xs)++          seekType = typeOf (undefined :: SeekException)+          unhandled e+              = SomeException $! EnumUnhandledIterException (IterException e)
src/Text/Parsec/Iteratee/LinkedList.hs view
@@ -27,6 +27,7 @@   ) where import Control.Concurrent.MVar+import Control.Exception import Control.Monad import Control.Monad.ST import Control.Monad.Trans.Class@@ -35,28 +36,29 @@ import Data.IORef import Data.ListLike as LL import Data.STRef+import Data.Typeable import Text.Parsec hiding (Stream) import qualified Text.Parsec as P  -- | Class notifing a reference in monad. -- Probably should be in separate module. class Monad m => Reference r m where-  -- | Create new reference-  newRef :: a -- ^ An initial value-         -> m (r a) -- ^ A new reference-  -- | Reads a reference-  readRef :: r a -- ^ Reference-          -> m a -- ^ Value hold by reference-  -- | Write to reference-  writeRef :: r a -- ^ Reference-           -> a -- ^ New value-           -> m ()-  -- | Modify the reference. Default implementation is provided but it MUST be-  -- overloaded if the reference is atomic to provide an atomic write-  modifyRef :: r a -- ^ Reference-            -> (a -> m (a, b)) -- ^ Computation-            -> m b -- ^ Result of computation-  modifyRef r f = readRef r >>= f >>= \(a, b) -> writeRef r a >> return b+    -- | Create new reference+    newRef :: a -- ^ An initial value+           -> m (r a) -- ^ A new reference+    -- | Reads a reference+    readRef :: r a -- ^ Reference+            -> m a -- ^ Value hold by reference+    -- | Write to reference+    writeRef :: r a -- ^ Reference+             -> a -- ^ New value+             -> m ()+    -- | Modify the reference. Default implementation is provided but it MUST+    -- be overloaded if the reference is atomic to provide an atomic write+    modifyRef :: r a -- ^ Reference+              -> (a -> m (a, b)) -- ^ Computation+              -> m b -- ^ Result of computation+    modifyRef r f = readRef r >>= f >>= \(a, b) -> writeRef r a >> return b  instance Reference IORef IO where     newRef = newIORef@@ -129,8 +131,12 @@     | otherwise = return . unconsChunk =<< lift (insertCursor r s) extendCursor r (EOF Nothing)     = const (return Nothing) =<< lift (writeRef r None)-extendCursor _ (EOF (Just e))-    = throwErr e+extendCursor r (EOF (Just se@(SomeException e)))+    | typeOf e == seekType = throwErr $ unhandled+    | otherwise = throwRecoverableErr se (extendCursor r)+    where seekType = typeOf (undefined :: SeekException)+          unhandled+              = SomeException $! EnumUnhandledIterException (IterException e)  unconsChunk :: (Monad m, Reference r m, ListLike s el)             => Cursor r m s el -> Maybe (el, Cursor r m s el)