Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- simplifyDefinition :: Definition -> Definition
- simplifyExpression :: Expression v -> Expression v
Documentation
simplifyDefinition :: Definition -> Definition Source #
Perform simplifyExpression
on all Expression
s inside the given
Definition
.
simplifyExpression :: Expression v -> Expression v Source #
Run the following simplifications on the given expression:
identity x = x
(f >> g) x = g (f x)
f >> identity = f
identity >> f = f
(f << g) x = f (g x)
f << identity = f
identity << f= f
identity <| x = x
x |> identity = x
x :: [y, z, ...] = [x, y, z, ...]
- Calls to
String.join
,String.concat
,List.concat
, and++
with known arguments are simplified. For example,String.join "" [Config.api, "endpoint"] = Config.api ++ "endpoint"
(x. e x) = e
- Inline
x
ine'
inlet x = e in e'
if either: e
is freely duplicable, e.g. it's just a variable or a numeric literal.x
occurs zero or one times ine'
.case e of ... prefixBranches pat -> branch ...
is simplified tolet xs = es in branch
provided thate
matches none ofprefixBranches
and that it matchespat
.- case-of-case
- { n = e, ... }.n = e