| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Language.Elm.Simplification
Synopsis
- simplifyDefinition :: Definition -> Definition
- simplifyExpression :: Expression v -> Expression v
Documentation
simplifyDefinition :: Definition -> Definition Source #
Perform simplifyExpression on all Expressions 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
xine'inlet x = e in e'if either: eis freely duplicable, e.g. it's just a variable or a numeric literal.xoccurs zero or one times ine'.case e of ... prefixBranches pat -> branch ...is simplified tolet xs = es in branchprovided thatematches none ofprefixBranchesand that it matchespat.- case-of-case
- { n = e, ... }.n = e