futhark-0.25.15: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageGHC2021

Futhark.Internalise.FullNormalise

Description

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