packages feed

th-alpha 0.1.0.1 → 0.1.0.2

raw patch · 3 files changed

+12/−12 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Language.Haskell.TH.Alpha: areExpEq :: Quasi m => ExpQ -> ExpQ -> m Bool
+ Language.Haskell.TH.Alpha: areExpAEq :: Quasi m => ExpQ -> ExpQ -> m Bool

Files

src/Language/Haskell/TH/Alpha.hs view
@@ -11,13 +11,13 @@ Compare TH expressions (or clauses, patterns, etc.) for alpha equivalence. That is, compare for equality modulo the renaming of bound variables. ->>> areExpEq [| \x -> x |] [| \y -> y |]+>>> areExpAEq [| \x -> x |] [| \y -> y |] True  This can be useful when for instance testing libraries that use Template Haskell: usually correctness is only defined up to alpha equivalence. -For most cases, 'areExpEq' is the only function you'll need. The 'AlphaEq'+For most cases, 'areExpAEq' is the only function you'll need. The 'AlphaEq' class is only exported to make it easier to expand alpha-equality comparison to other instances, or to be used (in combination with the package __th-desugar__) for alpha equality comparisons of non-expression@@ -27,7 +27,7 @@ -}  module Language.Haskell.TH.Alpha (-    areExpEq,+    areExpAEq,     exp_equal,     AlphaEq(..)     ) where@@ -65,13 +65,13 @@  -- | Convenience function that uses 'runQ' on 'exp_equal'. ----- >>> areExpEq [| let x = 5 in x |] [| let y = 5 in y |]+-- >>> areExpAEq [| let x = 5 in x |] [| let y = 5 in y |] -- True-areExpEq :: Quasi m+areExpAEq :: Quasi m          => ExpQ    -- ^ Quoted expression          -> ExpQ    -- ^ Quoted expression          -> m Bool-areExpEq e1 e2 = let expM = (join .) . liftM2 exp_equal+areExpAEq e1 e2 = let expM = (join .) . liftM2 exp_equal                  in expM (runQ e1) (runQ e2)  -- | Compare two expressions for alpha-equivalence. Since this uses
tests/tests.hs view
@@ -18,19 +18,19 @@ unitTests = testGroup "Unit tests"   [ testCase "Lambda expressions with different bound variables" $     do-       b <- areExpEq [| \x -> x|]  [| \y -> y|]+       b <- areExpAEq [| \x -> x|]  [| \y -> y|]        assertBool "Expressions not considered equal!" b   , testCase "Equal literals" $     do-       b <- areExpEq [| 5 |] [| 5 |]+       b <- areExpAEq [| 5 |] [| 5 |]        assertBool "Expressions not considered equal!" b   , testCase "Different constructors" $     do-       b <- areExpEq [| Left 5 |]  [| Right 5 |]+       b <- areExpAEq [| Left 5 |]  [| Right 5 |]        assertBool "Expressions considered equal!" (not b)   , testCase "Let bindings" $     do-       b <- areExpEq [| let x = 5 in x |] [| let y = 5 in y |]+       b <- areExpAEq [| let x = 5 in x |] [| let y = 5 in y |]        assertBool "Expressions not considered equal!" b   ] 
th-alpha.cabal view
@@ -2,13 +2,13 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                th-alpha-version:             0.1.0.1+version:             0.1.0.2 synopsis:            Alpha equivalence for TH Exp description:              Compare TH expressions (or clauses, patterns, etc.) for alpha equivalence.     That is, compare for equality modulo the renaming of bound variables.     .-    >>> areExpEq [| \x -> x |] [| \y -> y |]+    >>> areExpAEq [| \x -> x |] [| \y -> y |]     True     .     This can be useful when for instance testing libraries that use Template