// SPDX-License-Identifier: CC-BY-SA-4.0
// SPDX-FileCopyrightText: 2024-2026 hyperpolymath (Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>)
= Lesson 7: Algebraic Effects

== Effect Declarations

Define computational effects:

[source,affinescript]
----
effect Console {
  fn print(s: String);
  fn read() -> String;
}
----

== Using Effects

Functions declare effects they perform:

[source,affinescript]
----
fn greet() -> () / Console {
  print("Hello!");
}
----

== Effect Handlers

Handle effects with custom behavior:

[source,affinescript]
----
handle greet() {
  print(s) => {
    // Custom printing logic
    resume ();
  }
}
----

Next: link:lesson-08-generics.adoc[Lesson 8: Generics]
