liveBook · Manning

Controller avatar

As explained in Functional Design and Architecture: Examples in Haskell

A controller avatar is an Hdl value containing a controller name that identifies an instantiated controller for subsequent operations.

A controller avatar is an Hdl value that carries a controller’s identity for later operations. Instead of passing a controller-name string to every action, setup supplies a Controller value to the continuation that follows it. section 5.2.2

This changes the script’s shape from a flat list of loosely related commands into a dependency-aware tree. RegisterComponent receives the controller avatar, so registration appears only after SetupController has produced it.

Passing the avatar through a script

SetupController creates lCtrl, then registration and sensor reading use lCtrl directly. A second setup similarly creates rCtrl, keeping each controller reference tied to its continuation.

How Functional Design and Architecture: Examples in Haskell covers it

How deep it goes
Explains the value’s type shape and script role, stopping short of interpreter implementation details.
Examples
Uses nested left- and right-booster setup scripts with component registration and sensor reading.
What it assumes
Assumes familiarity with Hdl methods and introduces Controller as a typed alternative to controller-name strings.
What you can do after
Build it from scratch by passing setup-produced Controller values into registration, status, and sensor operations.
How it connects
Connects algebraic data types, embedded domain-specific languages, continuations, and controller setup.

This explainer was generated by Manning's knowledge graph from the text of Functional Design and Architecture: Examples in Haskell. The section links point to the parts of the book it draws on.