kure 2.12.0 → 2.12.2
raw patch · 3 files changed
+31/−5 lines, 3 filesdep +transformersPVP ok
version bump matches the API change (PVP)
Dependencies added: transformers
API changes (from Hackage documentation)
+ Language.KURE.MonadCatch: instance MonadCatch IO
+ Language.KURE.MonadCatch: liftAndCatchIO :: (MonadCatch m, MonadIO m) => IO a -> m a
+ Language.KURE.Translate: instance MonadIO m => MonadIO (Translate c m a)
Files
- Language/KURE/MonadCatch.hs +17/−0
- Language/KURE/Translate.hs +8/−0
- kure.cabal +6/−5
Language/KURE/MonadCatch.hs view
@@ -18,6 +18,8 @@ , runKureM , fromKureM , liftKureM+ -- ** The IO Monad+ , liftAndCatchIO -- ** Combinators , (<+) , catchesM@@ -35,7 +37,9 @@ import Prelude hiding (foldr) import Control.Applicative+import Control.Exception (catch, SomeException) import Control.Monad+import Control.Monad.IO.Class import Data.Foldable import Data.List (isPrefixOf)@@ -173,5 +177,18 @@ withPatFailMsg :: MonadCatch m => String -> m a -> m a withPatFailMsg msg = modFailMsg (\ e -> if "Pattern match failure" `isPrefixOf` e then msg else e) {-# INLINE withPatFailMsg #-}++------------------------------------------------------------------------------------------++-- | The String is generated by 'show'ing the exception.+instance MonadCatch IO where+ catchM :: IO a -> (String -> IO a) -> IO a+ catchM io f = io `catch` (\ e -> f $ show (e :: SomeException))+ {-# INLINE catchM #-}++-- | Lift a computation from the 'IO' monad, catching failures in the target monad.+liftAndCatchIO :: (MonadCatch m, MonadIO m) => IO a -> m a+liftAndCatchIO io = join $ liftIO (liftM return io `catchM` (return . fail))+{-# INLINE liftAndCatchIO #-} ------------------------------------------------------------------------------------------
Language/KURE/Translate.hs view
@@ -33,6 +33,7 @@ import Control.Applicative import Control.Monad+import Control.Monad.IO.Class import Control.Category import Control.Arrow @@ -141,6 +142,13 @@ mplus :: Translate c m a b -> Translate c m a b -> Translate c m a b mplus t1 t2 = translate $ \ c a -> apply t1 c a `mplus` apply t2 c a {-# INLINE mplus #-}++-- | Lifting through a Reader transformer, where (c,a) is the read-only environment.+instance MonadIO m => MonadIO (Translate c m a) where++ liftIO :: IO b -> Translate c m a b+ liftIO = constT . liftIO+ {-# INLINE liftIO #-} ------------------------------------------------------------------------------------------
kure.cabal view
@@ -1,5 +1,5 @@ Name: kure-Version: 2.12.0+Version: 2.12.2 Synopsis: Combinators for Strategic Programming Description: The Kansas University Rewrite Engine (KURE) is a domain-specific language for strategic rewriting. KURE was inspired by Stratego and StrategyLib, and has similarities with Scrap Your Boilerplate and Uniplate.@@ -19,7 +19,7 @@ License-file: LICENSE Author: Neil Sculthorpe and Andy Gill Maintainer: Neil Sculthorpe <neil@ittc.ku.edu>-Copyright: (c) 2012--2013 The University of Kansas+Copyright: (c) 2006--2013 The University of Kansas Homepage: http://www.ittc.ku.edu/csdl/fpg/software/kure.html Stability: beta build-type: Simple@@ -40,9 +40,10 @@ examples/Expr/Examples.hs Library- Build-Depends: base >= 4.5 && < 5,- dlist >= 0.2 && < 1,- ghc >= 7.6+ Build-Depends: base >= 4.5 && < 5,+ dlist >= 0.2 && < 1,+ ghc >= 7.6,+ transformers >= 0.2 && < 1 Ghc-Options: -Wall Exposed-modules: Language.KURE