kure 2.16.10 → 2.16.12
raw patch · 13 files changed
+128/−17 lines, 13 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Language.KURE.BiTransform: instance Typeable BiTransform
+ Language.KURE.Combinators.Transform: instance Typeable AnyR
+ Language.KURE.Combinators.Transform: instance Typeable OneR
+ Language.KURE.ExtendableContext: instance Typeable ExtendContext
+ Language.KURE.Injection: instance Typeable Injection
+ Language.KURE.Lens: instance Typeable Lens
+ Language.KURE.MonadCatch: instance Typeable KureM
+ Language.KURE.MonadCatch: instance Typeable MonadCatch
+ Language.KURE.Path: instance Typeable ExtendPath
+ Language.KURE.Path: instance Typeable ReadPath
+ Language.KURE.Path: instance Typeable SnocPath
+ Language.KURE.Transform: instance Typeable Transform
+ Language.KURE.Walker: instance Typeable Walker
Files
- CHANGELOG.md +6/−0
- Language/KURE/BiTransform.hs +10/−1
- Language/KURE/Combinators/Transform.hs +16/−3
- Language/KURE/ExtendableContext.hs +8/−1
- Language/KURE/Injection.hs +14/−1
- Language/KURE/Lens.hs +10/−1
- Language/KURE/MonadCatch.hs +11/−3
- Language/KURE/Path.hs +18/−2
- Language/KURE/Pathfinder.hs +3/−1
- Language/KURE/Transform.hs +10/−1
- Language/KURE/Walker.hs +16/−2
- README.md +3/−0
- kure.cabal +3/−1
+ CHANGELOG.md view
@@ -0,0 +1,6 @@+## 2.16.12+* Derive `Typeable` instances++## 2.16.5+* Allowed building with `base-4.8.0.0`+* Removed unneeded `Monoid` constraints on `OneT` instances
Language/KURE/BiTransform.hs view
@@ -1,4 +1,6 @@-{-# Language InstanceSigs #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE InstanceSigs #-} -- | -- Module: Language.KURE.BiTransform -- Copyright: (c) 2012--2014 The University of Kansas@@ -36,6 +38,10 @@ import Control.Category +#if __GLASGOW_HASKELL__ >= 708+import Data.Typeable+#endif+ import Language.KURE.MonadCatch import Language.KURE.Transform import Language.KURE.Injection@@ -46,6 +52,9 @@ data BiTransform c m a b = BiTransform {forwardT :: Transform c m a b, -- ^ Extract the forward 'Transform' from a 'BiTransform'. backwardT :: Transform c m b a -- ^ Extract the backward 'Transform' from a 'BiTransform'. }+#if __GLASGOW_HASKELL__ >= 708+ deriving Typeable+#endif -- | A deprecated synonym for 'BiTranslate'. type BiTranslate c m a b = BiTransform c m a b
Language/KURE/Combinators/Transform.hs view
@@ -1,4 +1,6 @@-{-# Language CPP, InstanceSigs #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE InstanceSigs #-} -- | -- Module: Language.KURE.Combinators.Transform -- Copyright: (c) 2012--2014 The University of Kansas@@ -58,6 +60,9 @@ import Data.Foldable import Data.Traversable+#if __GLASGOW_HASKELL__ >= 708+import Data.Typeable+#endif import Language.KURE.Combinators.Arrow import Language.KURE.Combinators.Monad@@ -165,11 +170,13 @@ in go {-# INLINE repeatR #-} --- | Attempt each trransformation until one succeeds, then return that result and discard the rest of the transformations.+-- | Attempt each transformation until one succeeds, then return that result and discard the rest of the transformations. catchesT :: MonadCatch m => [Transform c m a b] -> Transform c m a b-catchesT = foldr (<+) (fail "catchesT failed")+catchesT = catchesM {-# INLINE catchesT #-}+{-# DEPRECATED catchesT "Please use 'catchesM' instead." #-} + -- | An identity transformation that resembles a monadic 'Control.Monad.join'. joinT :: Transform c m (m a) a joinT = contextfreeT id@@ -205,6 +212,9 @@ -- causes a sequence of rewrites to succeed if at least one succeeds, converting failures to -- identity rewrites. newtype AnyR m a = AnyR (m (PBool a))+#if __GLASGOW_HASKELL__ >= 708+ deriving Typeable+#endif unAnyR :: AnyR m a -> m (PBool a) unAnyR (AnyR mba) = mba@@ -264,6 +274,9 @@ -- | The 'OneR' transformer, in combination with 'wrapOneR' and 'unwrapOneR', -- causes a sequence of rewrites to only apply the first success, converting the remainder (and failures) to identity rewrites. newtype OneR m a = OneR (Bool -> m (PBool a))+#if __GLASGOW_HASKELL__ >= 708+ deriving Typeable+#endif unOneR :: OneR m a -> Bool -> m (PBool a) unOneR (OneR mba) = mba
Language/KURE/ExtendableContext.hs view
@@ -1,4 +1,8 @@-{-# LANGUAGE InstanceSigs, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE InstanceSigs #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE UndecidableInstances #-} -- | -- Module: Language.KURE.ExtendableContext -- Copyright: (c) 2012--2014 The University of Kansas@@ -21,6 +25,8 @@ , extraContext ) where +import Data.Typeable+ import Language.KURE.Path ------------------------------------------------------------------------------------------------@@ -32,6 +38,7 @@ -- | Retrieve the extra contextual information. , extraContext :: e }+ deriving Typeable -- | Extend a context with some additional information. extendContext :: e -> c -> ExtendContext c e
Language/KURE/Injection.hs view
@@ -1,4 +1,9 @@-{-# LANGUAGE InstanceSigs, MultiParamTypeClasses, FlexibleInstances #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE InstanceSigs #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE StandaloneDeriving #-} -- | -- Module: Language.KURE.Injection -- Copyright: (c) 2012--2014 The University of Kansas@@ -34,6 +39,10 @@ import Control.Arrow +#if __GLASGOW_HASKELL__ >= 708+import Data.Typeable+#endif+ import Language.KURE.Transform -------------------------------------------------------------------------------@@ -46,6 +55,10 @@ class Injection a u where inject :: a -> u project :: u -> Maybe a++#if __GLASGOW_HASKELL__ >= 708+deriving instance Typeable Injection+#endif -- | There is an identity injection for all types. instance Injection a a where
Language/KURE/Lens.hs view
@@ -1,4 +1,6 @@-{-# Language InstanceSigs #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE InstanceSigs #-} -- | -- Module: Language.KURE.Lens -- Copyright: (c) 2012--2014 The University of Kansas@@ -32,6 +34,10 @@ import Control.Category import Control.Arrow +#if __GLASGOW_HASKELL__ >= 708+import Data.Typeable+#endif+ import Language.KURE.MonadCatch import Language.KURE.Transform import Language.KURE.BiTransform@@ -43,6 +49,9 @@ -- | A 'Lens' is a way to focus on a sub-structure of type @b@ from a structure of type @a@. newtype Lens c m a b = Lens { -- | Convert a 'Lens' into a 'Transform' that produces a sub-structure (and its context) and an unfocussing function. lensT :: Transform c m a ((c,b), b -> m a)}+#if __GLASGOW_HASKELL__ >= 708+ deriving Typeable+#endif -- | The primitive way of building a 'Lens'. -- If the unfocussing function is applied to the value focussed on then it should succeed,
Language/KURE/MonadCatch.hs view
@@ -1,4 +1,7 @@-{-# Language CPP, InstanceSigs #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE InstanceSigs #-}+{-# LANGUAGE StandaloneDeriving #-} -- | -- Module: Language.KURE.MonadCatch -- Copyright: (c) 2012--2014 The University of Kansas@@ -42,6 +45,7 @@ import Data.Foldable import Data.List (isPrefixOf)+import Data.Typeable import Language.KURE.Combinators.Monad @@ -64,13 +68,17 @@ -- | Catch a failing monadic computation. catchM :: m a -> (String -> m a) -> m a +#if __GLASGOW_HASKELL__ >= 708+deriving instance Typeable MonadCatch+#endif+ ------------------------------------------------------------------------------------------ -- | 'KureM' is the minimal structure that can be an instance of 'MonadCatch'. -- The KURE user is free to either use 'KureM' or provide their own monad. -- 'KureM' is essentially the same as 'Either' 'String', except that it supports a 'MonadCatch' instance which 'Either' 'String' does not (because its 'fail' method calls 'error') -- A major advantage of this is that monadic pattern match failures are caught safely.-data KureM a = Failure String | Success a deriving (Eq, Show)+data KureM a = Failure String | Success a deriving (Eq, Show, Typeable) -- | Eliminator for 'KureM'. runKureM :: (a -> b) -> (String -> b) -> KureM a -> b@@ -126,7 +134,7 @@ -- | A monadic catch that ignores the error message. (<+) :: MonadCatch m => m a -> m a -> m a-ma <+ mb = ma `catchM` const mb+ma <+ mb = ma `catchM` (\_ -> mb) {-# INLINE (<+) #-} -- | Select the first monadic computation that succeeds, discarding any thereafter.
Language/KURE/Path.hs view
@@ -1,4 +1,10 @@-{-# LANGUAGE CPP, InstanceSigs, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE InstanceSigs #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE StandaloneDeriving #-} -- | -- Module: Language.KURE.Path -- Copyright: (c) 2012--2014 The University of Kansas@@ -43,6 +49,8 @@ import Control.Arrow ((>>^)) +import Data.Typeable+ import Language.KURE.Transform import Language.KURE.Combinators.Transform import Language.KURE.Injection@@ -56,7 +64,7 @@ ------------------------------------------------------------------------------- -- | A 'SnocPath' is a list stored in reverse order.-newtype SnocPath crumb = SnocPath [crumb] deriving Eq+newtype SnocPath crumb = SnocPath [crumb] deriving (Eq, Typeable) instance Monoid (SnocPath crumb) where mempty :: SnocPath crumb@@ -106,6 +114,10 @@ -- | Extend the current 'AbsolutePath' by one crumb. (@@) :: c -> crumb -> c +#if __GLASGOW_HASKELL__ >= 708+deriving instance Typeable ExtendPath+#endif+ -- | A 'SnocPath' from the root. type AbsolutePath = SnocPath @@ -116,6 +128,10 @@ class ReadPath c crumb | c -> crumb where -- | Read the current absolute path. absPath :: c -> AbsolutePath crumb++#if __GLASGOW_HASKELL__ >= 708+deriving instance Typeable ReadPath+#endif -- | Lifted version of 'absPath'. absPathT :: (ReadPath c crumb, Monad m) => Transform c m a (AbsolutePath crumb)
Language/KURE/Pathfinder.hs view
@@ -1,4 +1,6 @@-{-# LANGUAGE CPP, ScopedTypeVariables, FlexibleContexts #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ScopedTypeVariables #-} -- | -- Module: Language.KURE.Pathfinder
Language/KURE/Transform.hs view
@@ -1,4 +1,7 @@-{-# Language CPP, InstanceSigs #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE InstanceSigs #-}+{-# LANGUAGE PolyKinds #-} -- | -- Module: Language.KURE.Transform -- Copyright: (c) 2012--2014 The University of Kansas@@ -41,6 +44,9 @@ #if __GLASGOW_HASKELL__ <= 708 import Data.Monoid #endif+#if __GLASGOW_HASKELL__ >= 708+import Data.Typeable+#endif import Language.KURE.MonadCatch @@ -50,6 +56,9 @@ -- The 'Transform' type is the basis of the entire KURE library. newtype Transform c m a b = Transform { -- | Apply a transformation to a value and its context. applyT :: c -> a -> m b}+#if __GLASGOW_HASKELL__ >= 708+ deriving Typeable+#endif -- | A deprecated synonym for 'Transform'. type Translate c m a b = Transform c m a b
Language/KURE/Walker.hs view
@@ -1,4 +1,10 @@-{-# LANGUAGE CPP, InstanceSigs, MultiParamTypeClasses, ScopedTypeVariables, FlexibleContexts #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE InstanceSigs #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE StandaloneDeriving #-} -- | -- Module: Language.KURE.Walker -- Copyright: (c) 2012--2014 The University of Kansas@@ -77,6 +83,9 @@ import Data.Maybe (isJust) import Data.Monoid import Data.DList (singleton, toList)+#if __GLASGOW_HASKELL__ >= 708+import Data.Typeable+#endif #if __GLASGOW_HASKELL__ <= 708 import Control.Applicative@@ -133,6 +142,10 @@ childL = childL_default {-# INLINE childL #-} +#if __GLASGOW_HASKELL__ >= 708+deriving instance Typeable Walker+#endif+ ------------------------------------------------------------------------------------------ -- | List the children of the current node.@@ -593,7 +606,8 @@ ------------------------------------------------------------------------------- childL_default :: forall c crumb m u. (ReadPath c crumb, Eq crumb) => (Walker c u, MonadCatch m) => crumb -> Lens c m u u-childL_default cr = lens $ do cu <- getter+childL_default cr = lens $ prefixFailMsg "childL failed: " $+ do cu <- getter k <- setter return (cu, k) where
+ README.md view
@@ -0,0 +1,3 @@+# KURE [](http://hackage.haskell.org/package/kure) [](https://travis-ci.org/ku-fpg/kure)++Combinators for Strategic Programming
kure.cabal view
@@ -1,5 +1,5 @@ Name: kure-Version: 2.16.10+Version: 2.16.12 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.@@ -25,6 +25,8 @@ build-type: Simple Cabal-Version: >= 1.10 Extra-Source-Files:+ README.md+ CHANGELOG.md examples/Examples.hs examples/Fib/AST.hs examples/Fib/Kure.hs