summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwardKmett <>2014-04-05 18:01:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-04-05 18:01:00 (GMT)
commit7fa226d55551621ddc767ec6fc436807b848b322 (patch)
tree0975a6ae5724f8517df6261fe0e47a91f0056874
parentb1822be28202820cb6794d198f1c0f2bf1fd0261 (diff)
version 1.0.11.0.1
-rw-r--r--CHANGELOG.markdown5
-rw-r--r--bound.cabal2
-rw-r--r--src/Bound/Class.hs8
-rw-r--r--src/Bound/Scope/Simple.hs5
4 files changed, 16 insertions, 4 deletions
diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
index 150788f..2b49fdb 100644
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,3 +1,8 @@
+1.0.1
+-----
+* Added a monomorphic `hoistScope` for `Bound.Scope.Simple`
+
+
1.0
---
* Added instances for `Bound` for all of the `mtl` monads.
diff --git a/bound.cabal b/bound.cabal
index 91a13bb..0c8424d 100644
--- a/bound.cabal
+++ b/bound.cabal
@@ -1,6 +1,6 @@
name: bound
category: Language, Compilers/Interpreters
-version: 1.0
+version: 1.0.1
license: BSD3
cabal-version: >= 1.9.2
license-file: LICENSE
diff --git a/src/Bound/Class.hs b/src/Bound/Class.hs
index 3363a82..ff726cb 100644
--- a/src/Bound/Class.hs
+++ b/src/Bound/Class.hs
@@ -39,13 +39,15 @@ infixl 1 >>>=
--
-- This means they should satisfy the following laws:
--
--- > m >>>= return ≡ m
--- > m >>>= (λ x → k x >>= h) ≡ (m >>>= k) >>>= h
+-- @
+-- m '>>>=' 'return' ≡ m
+-- m '>>>=' (λ x → k x '>>=' h) ≡ (m '>>>=' k) '>>>=' h
+-- @
--
-- This guarantees that a typical Monad instance for an expression type
-- where Bound instances appear will satisfy the Monad laws (see doc/BoundLaws.hs).
--
--- If instances of Bound are monad transformers, then @m '>>>=' f ≡ m '>>=' 'lift' '.' f@
+-- If instances of 'Bound' are monad transformers, then @m '>>>=' f ≡ m '>>=' 'lift' '.' f@
-- implies the above laws, and is in fact the default definition.
--
-- This is useful for types like expression lists, case alternatives,
diff --git a/src/Bound/Scope/Simple.hs b/src/Bound/Scope/Simple.hs
index 400eecd..844051e 100644
--- a/src/Bound/Scope/Simple.hs
+++ b/src/Bound/Scope/Simple.hs
@@ -56,6 +56,7 @@ module Bound.Scope.Simple
, mapMScope
, serializeScope
, deserializeScope
+ , hoistScope
) where
import Bound.Class
@@ -232,6 +233,10 @@ instantiate1 :: Monad f => f a -> Scope n f a -> f a
instantiate1 e = instantiate (const e)
{-# INLINE instantiate1 #-}
+hoistScope :: Monad f => (f (Var b a) -> g (Var b a)) -> Scope b f a -> Scope b g a
+hoistScope f = Scope . f . unscope
+{-# INLINE hoistScope #-}
+
-------------------------------------------------------------------------------
-- Compatibility with Bound.Scope
-------------------------------------------------------------------------------