ajhc-0.8.0.7: Haskell compiler that produce binary through C language

Safe HaskellNone

Grin.Whiz

Synopsis

Documentation

whizSource

Arguments

:: 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.

fizzSource

Arguments

:: 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.

applySubstE :: (Monad m, MapLike m1, ~ * (Key m1) Var, ~ * (Value m1) Val) => m1 -> Exp -> m ExpSource

applySubst :: (Monad m1, MapLike m, ~ * (Key m) Var, ~ * (Value m) Val) => m -> Val -> m1 ValSource

whizExps :: Monad m => (Exp -> m Exp) -> Lam -> m LamSource