Copyright | (c) Kimiyuki Onaka 2021 |
---|---|
License | Apache License 2.0 |
Maintainer | kimiyuki95@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- run :: (MonadAlpha m, MonadError Error m) => Program -> m Program
- rule :: MonadAlpha m => RewriteRule m
- reduceAll :: MonadAlpha m => RewriteRule m
- reduceAny :: MonadAlpha m => RewriteRule m
Documentation
run :: (MonadAlpha m, MonadError Error m) => Program -> m Program Source #
Examples
Before:
any (filter (fun x -> x || f x) xs)
After:
any xs || any (map f xs)
List of builtin functions which are reduced
\[ \newcommand\int{\mathbf{int}} \newcommand\bool{\mathbf{bool}} \newcommand\list{\mathbf{list}} \]
Target functions
Boolean functions
Not
\(: \bool \to \bool\)And
\(: \bool \to \bool \to \bool\)Or
\(: \bool \to \bool \to \bool\)Implies
\(: \bool \to \bool \to \bool\)
List Build functions
Nil
\(: \forall \alpha. \list(\alpha)\)Cons
\(: \forall \alpha. \alpha \to \list(\alpha) \to \list(\alpha)\)
List Map functions
internal rules
rule :: MonadAlpha m => RewriteRule m Source #
reduceAll :: MonadAlpha m => RewriteRule m Source #
reduceAny :: MonadAlpha m => RewriteRule m Source #