Safe Haskell | None |
---|

- whiz :: Monad m => (forall a. [Val] -> m a -> m a) -> (([Val], Exp) -> m (Maybe ([Val], Exp))) -> (Exp -> m Exp) -> WhizState -> Lam -> m (Lam, WhizState)
- fizz :: Monad m => (forall a. [Val] -> m a -> m a) -> (([Val], Exp) -> m (Maybe ([Val], Exp))) -> (Exp -> m Exp) -> WhizState -> Lam -> m (Lam, WhizState)
- type WhizState = Either (Set Int) Int
- whizState :: WhizState
- normalizeGrin :: Grin -> Grin
- normalizeGrin' :: Grin -> Grin
- applySubstE :: (Monad m, MapLike m1, ~ * (Key m1) Var, ~ * (Value m1) Val) => m1 -> Exp -> m Exp
- applySubst :: (Monad m1, MapLike m, ~ * (Key m) Var, ~ * (Value m) Val) => m -> Val -> m1 Val
- whizExps :: Monad m => (Exp -> m Exp) -> Lam -> m Lam

# Documentation

:: Monad m | |

=> (forall a. [Val] -> m a -> m a) | called for each sub-code block, such as in case statements |

-> (([Val], Exp) -> m (Maybe ([Val], Exp))) | routine to transform or omit simple bindings |

-> (Exp -> m Exp) | routine to transform final statement in code block |

-> WhizState | Initial state |

-> Lam | input lambda expression |

-> m (Lam, WhizState) |

magic traversal and flattening routine.
whiz traverses Grin code and right assosiates it as well as renaming and
repeated variables along the way.
in addition, it provides a nice monadic traversal of the flattened renamed code suitable
for a wide range of grin -> grin transformations.
basically, you may use `whiz`

to perform tranformations which do not require lookahead, and depend
only on the code that happened before.
note that a case is presented after all of its sub code blocks have been processed
Whiz also vectorizes tuple->tuple assignments, breaking them into individual assignments
for its components to better aid future optimizations.

:: Monad m | |

=> (forall a. [Val] -> m a -> m a) | called for each sub-code block, such as in case statements |

-> (([Val], Exp) -> m (Maybe ([Val], Exp))) | routine to transform or omit simple bindings |

-> (Exp -> m Exp) | routine to transform final statement in code block |

-> WhizState | Initial state |

-> Lam | input lambda expression |

-> m (Lam, WhizState) |

magic traversal and flattening routine.
whiz traverses Grin code and right assosiates it as well as renaming and
repeated variables along the way.
in addition, it provides a nice monadic traversal of the flattened renamed code suitable
for a wide range of grin -> grin transformations.
basically, you may use `whiz`

to perform tranformations which do not require lookahead, and depend
only on the code that happened before.
note that a case is presented after all of its sub code blocks have been processed
Whiz also vectorizes tuple->tuple assignments, breaking them into individual assignments
for its components to better aid future optimizations.
fizz is similar to whiz, but processes things in 'bottom-up' order.
fizz also removes all statements past an Error.

normalizeGrin :: Grin -> GrinSource

normalizeGrin' :: Grin -> GrinSource