@hackage th-alpha0.2.1.0

Alpha equivalence for TH Exp

Compare TH expressions (or clauses, patterns, etc.) for alpha equivalence. That is, compare for equality modulo the renaming of bound variables.

areExpAEq [| \x -> x |] [| \y -> y |]
-- True
do
   let x = mkName "x"
   let y = mkName "y"
   runQ $ (LamE [VarP x] (VarE x)) @= (LamE [VarP y] (VarE y))
-- True

This can be useful when for instance testing libraries that use Template Haskell - usually correctness is only defined up to alpha equivalence.