speculate-0.3.5: discovery of properties about Haskell functions

Copyright(c) 2016-2017 Rudy Matela
License3-Clause BSD (see the file LICENSE)
MaintainerRudy Matela <rudy@matela.com.br>
Safe HaskellNone
LanguageHaskell2010

Test.Speculate.Expr.Canon

Description

This module is part of Speculate.

Canonicalize and check canonicity of expressions.

Synopsis

Documentation

canonicalizeWith :: Instances -> Expr -> Expr Source #

Canonicalize variable names in an expression.

canonicalize (x + y) = (x + y)
canonicalize (y + x) = (x + y)
canonicalize (y + (z + x)) = (x + (y + z))
canonicalize ((w + z) + (z + x)) = ((x + y) + (y + z))
canonicalize (y + abs y) = (x + abs x)
canonicalize ((y + x) == (x + y)) = ((x + y) == (y + x))