Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This full normalisation module converts a well-typed, polymorphic, module-free Futhark program into an equivalent with only simple expresssions. Notably, all non-trivial expression are converted into a list of let-bindings to make them simpler, with no nested apply, nested lets... This module only performs syntactic operations.
Also, it performs various kinds of desugaring:
- Turns operator sections into explicit lambdas.
- Rewrites BinOp nodes to Apply nodes (&& and || are converted to conditionals).
- Turns `let x [i] = e1` into `let x = x with [i] = e1`.
- Binds all implicit sizes.
- Turns implicit record fields into explicit record fields.
This is currently not done for expressions inside sizes, this processing still needed in monomorphisation for now.
Documentation
transformProg :: MonadFreshNames m => [ValBind] -> m [ValBind] Source #