-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Alpha equivalence for TH Exp -- @package th-alpha @version 0.2.0.2 -- | 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 ---- -- 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, 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 types (e.g. TyVarBndr). -- -- N.B.: This package doesn't yet handle type annotations -- correctly! module Language.Haskell.TH.Alpha -- | Convenience function that uses runQ on expEqual. -- --
-- >>> areExpAEq [| let x = 5 in x |] [| let y = 5 in y |] -- True --areExpAEq :: DsMonad m => ExpQ -> ExpQ -> m Bool expEqual :: DsMonad m => Exp -> Exp -> m Bool -- | Compares its arguments for alpha equivalence. The default -- implementation uses Lookup for its LookupTbl, but more efficient -- datatypes can be used. (@=) :: (Monad m, AlphaEq a m) => a -> a -> m Bool -- | The main Alpha Equivalence class. @= is by default defined in -- terms of lkEq. lkEq is exposed for composability: it is -- easy to recursively build AlphaEq instances from other -- AlphaEq instances by delegating the lookup update to the -- subinstances. class AlphaEq a m | a -> m lkEq :: AlphaEq a m => a -> a -> LookupSTM m () instance Functor m => Functor (LookupSTM m) instance (Monad m, Functor m) => Applicative (LookupSTM m) instance Monad m => Monad (LookupSTM m) instance Monad m => MonadState LookupTbl (LookupSTM m) instance Monad m => MonadPlus (LookupSTM m) instance (Monad m, Functor m) => Alternative (LookupSTM m) instance AlphaEq DPat Identity instance AlphaEq DPred Identity instance AlphaEq DClause Identity instance AlphaEq DKind Identity instance AlphaEq DType Identity instance AlphaEq DLetDec Identity instance AlphaEq DMatch Identity instance AlphaEq DExp Identity instance AlphaEq Exp Q instance MFunctor LookupSTM instance MonadTrans LookupSTM