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 :: Monad m => RewriteRule m
- reduceMin :: Monad m => RewriteRule m
- reduceMax :: Monad m => RewriteRule m
- reduceArgMin :: Monad m => RewriteRule m
- reduceArgMax :: Monad m => RewriteRule m
Documentation
run :: (MonadAlpha m, MonadError Error m) => Program -> m Program Source #
run
reduces maximums and minimums.
Examples
Before:
max (map (fun x -> 3 + f x) xs)
After:
3 + max (map f xs)
List of builtin functions which are reduced
\[ \newcommand\int{\mathbf{int}} \newcommand\bool{\mathbf{bool}} \newcommand\list{\mathbf{list}} \]
Target functions
Max1
\(: \forall \alpha. \list(\alpha) \to \alpha\)Min1
\(: \forall \alpha. \list(\alpha) \to \alpha\)ArgMax
\(: \forall \alpha. \list(\alpha) \to \int\)ArgMin
\(: \forall \alpha. \list(\alpha) \to \int\)
Related functions
Max2
\(: \forall \alpha. \alpha \to \alpha \to \alpha\)Min2
\(: \forall \alpha. \alpha \to \alpha \to \alpha\)
List Build functions
Nil
\(: \forall \alpha. \list(\alpha)\)Cons
\(: \forall \alpha. \alpha \to \list(\alpha) \to \list(\alpha)\)Range1
\(: \int \to \list(\int)\)
List Map functions
internal rules
rule :: Monad m => RewriteRule m Source #
reduceMin :: Monad m => RewriteRule m Source #
reduceMax :: Monad m => RewriteRule m Source #
reduceArgMin :: Monad m => RewriteRule m Source #
TODO: implement this
reduceArgMax :: Monad m => RewriteRule m Source #
TODO: implement this