Skip to main content

Effects

info

Fuyu will eventually support algebraic effects, but the exact design is still under research and has not been finalized.

Current state of effects

Effects are specified at the very end of a function type signature. The only effect that exists right now is the IO effect, which simply marks that the function interacts with the outside world. Currently, custom effects cannot be declared, and effects have no purpose other than tracking the purity of a function.

import std/io

// Effect: |---|
function main() -> () :: IO {
io.println("Hello")
}

Future plans for effects

  • Custom effects can be declared with the effect keyword.
  • Effects will support resumption.
  • Polymorphic effects.
  • Structure for providing ad hoc effect instances within a specific context.
  • Effect sets that support type/effect level union, intersection, and negation.