bound 1.0.3 → 1.0.4
raw patch · 3 files changed
+34/−3 lines, 3 filesdep ~transformersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: transformers
API changes (from Hackage documentation)
- Bound.Name: instance Typeable2 Name
- Bound.Scope: instance (Typeable b, Typeable1 f) => Typeable1 (Scope b f)
- Bound.Scope: instance (Typeable b, Typeable1 f, Data a, Data (f (Var b (f a)))) => Data (Scope b f a)
- Bound.Scope.Simple: instance (Typeable b, Typeable1 f) => Typeable1 (Scope b f)
- Bound.Scope.Simple: instance (Typeable b, Typeable1 f, Data a, Data (f (Var b a))) => Data (Scope b f a)
- Bound.Var: instance Typeable2 Var
+ Bound.Name: instance Typeable Name
+ Bound.Scope: instance (Typeable b, Typeable f, Data a, Data (f (Var b (f a)))) => Data (Scope b f a)
+ Bound.Scope: instance Typeable Scope
+ Bound.Scope.Simple: bitransverseScope :: Applicative f => (forall a a'. (a -> f a') -> t a -> f (u a')) -> forall a a'. (a -> f a') -> Scope b t a -> f (Scope b u a')
+ Bound.Scope.Simple: bitraverseScope :: (Bitraversable t, Applicative f) => (k -> f k') -> (a -> f a') -> Scope b (t k) a -> f (Scope b (t k') a')
+ Bound.Scope.Simple: instance (Typeable b, Typeable f, Data a, Data (f (Var b a))) => Data (Scope b f a)
+ Bound.Scope.Simple: instance Typeable Scope
+ Bound.Scope.Simple: instantiateVars :: Monad t => [a] -> Scope Int t a -> t a
+ Bound.Scope.Simple: transverseScope :: Functor f => (forall r. g r -> f (h r)) -> Scope b g a -> f (Scope b h a)
+ Bound.Var: instance Typeable Var
Files
- CHANGELOG.markdown +4/−0
- bound.cabal +3/−3
- src/Bound/Scope/Simple.hs +27/−0
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+1.0.4+-----+* Widened version bound on `transformers`.+ 1.0.3 ----- * Added `bitransverseScope`.
bound.cabal view
@@ -1,6 +1,6 @@ name: bound category: Language, Compilers/Interpreters-version: 1.0.3+version: 1.0.4 license: BSD3 cabal-version: >= 1.9.2 license-file: LICENSE@@ -75,7 +75,7 @@ hashable-extras >= 0.1 && < 1, prelude-extras >= 0.3 && < 1, profunctors >= 3.3 && < 5,- transformers >= 0.2 && < 0.4+ transformers >= 0.2 && < 0.5 ghc-options: -Wall -O2 -fspec-constr -fdicts-cheap -funbox-strict-fields @@ -86,7 +86,7 @@ type: exitcode-stdio-1.0 main-is: Simple.hs hs-source-dirs: examples- ghc-options -Wall -threaded+ ghc-options: -Wall -threaded if impl(ghc<7.6.1) ghc-options: -Werror build-depends:
src/Bound/Scope/Simple.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE Rank2Types #-} #if defined(__GLASGOW_HASKELL__) {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-}@@ -57,6 +58,10 @@ , serializeScope , deserializeScope , hoistScope+ , bitraverseScope+ , bitransverseScope+ , transverseScope+ , instantiateVars ) where import Bound.Class@@ -355,6 +360,28 @@ (b -> g d) -> (a -> g c) -> Scope b f a -> g (Scope d f c) traverseScope f g (Scope s) = Scope <$> traverse (bitraverse f g) s {-# INLINE traverseScope #-}++-- | This allows you to 'bitraverse' a 'Scope'.+bitraverseScope :: (Bitraversable t, Applicative f) => (k -> f k') -> (a -> f a') -> Scope b (t k) a -> f (Scope b (t k') a')+bitraverseScope f = bitransverseScope (bitraverse f)+{-# INLINE bitraverseScope #-}++-- | This is a higher-order analogue of 'traverse'.+transverseScope :: (Functor f)+ => (forall r. g r -> f (h r))+ -> Scope b g a -> f (Scope b h a)+transverseScope tau (Scope s) = Scope <$> tau s++-- | instantiate bound variables using a list of new variables+instantiateVars :: Monad t => [a] -> Scope Int t a -> t a+instantiateVars as = instantiate (vs !!) where+ vs = map return as+{-# INLINE instantiateVars #-}++bitransverseScope :: Applicative f => (forall a a'. (a -> f a') -> t a -> f (u a'))+ -> forall a a'. (a -> f a') -> Scope b t a -> f (Scope b u a')+bitransverseScope tau f (Scope s) = Scope <$> tau (traverse f) s+{-# INLINE bitransverseScope #-} -- | mapM over both bound and free variables mapMBound :: (Monad m, Traversable f) =>