An ordinary signature Δ consists of operations 𝖮𝗉Δ and response sets 𝖱𝖾𝗍Δ(𝑜). Its disjoint sum is 𝖮𝗉Δ1⊕𝗌𝗂𝗀Δ2=𝖮𝗉Δ1+𝖮𝗉Δ2,𝖱𝖾𝗍Δ1⊕𝗌𝗂𝗀Δ2(𝜄𝑖𝑜)=𝖱𝖾𝗍Δ𝑖(𝑜). A higher-order signature 𝐻 consists of 𝖮𝗉𝖧𝐻,𝖥𝗈𝗋𝗄𝐻(𝑜),𝖱𝖾𝗍𝖧𝐻(𝑜). Here 𝖥𝗈𝗋𝗄𝐻(𝑜) is itself an ordinary signature and describes the nested computations owned by 𝑜. The sum 𝐻1 ⊞𝐻2 is the disjoint sum of operation tags, with fork and return families selected by cases on the tag.
For 𝐴 :𝐒𝐞𝐭, hefty trees have constructors 𝗉𝗎𝗋𝖾(𝑎):𝖧𝖾𝖿𝗍𝗒𝐻(𝐴),𝗂𝗆𝗉𝗎𝗋𝖾(𝑜,𝜓,𝑘):𝖧𝖾𝖿𝗍𝗒𝐻(𝐴), where 𝜓:∏𝑠:𝖮𝗉𝖥𝗈𝗋𝗄𝐻(𝑜)𝖧𝖾𝖿𝗍𝗒𝐻(𝖱𝖾𝗍𝖥𝗈𝗋𝗄𝐻(𝑜)(𝑠)),𝑘:𝖱𝖾𝗍𝖧𝐻(𝑜)⟶𝖧𝖾𝖿𝗍𝗒𝐻(𝐴). The source bind traverses only the ordinary continuation: 𝗉𝗎𝗋𝖾(𝑥)≫=𝖧𝑔=𝑔(𝑥),𝗂𝗆𝗉𝗎𝗋𝖾(𝑜,𝜓,𝑘)≫=𝖧𝑔=𝗂𝗆𝗉𝗎𝗋𝖾(𝑜,𝜓,𝜆𝑥.𝑘(𝑥)≫=𝖧𝑔). Traversing 𝜓 would push the continuation into operation-owned subcomputations and is generally ill typed.
For a family 𝐺 :𝐒𝐞𝐭 ⟶𝐒𝐞𝐭, a hefty algebra has components 𝛼𝐴(𝑜,−,−):⎛⎜
⎜
⎜
⎜
⎜⎝∏𝑠:𝖮𝗉𝖥𝗈𝗋𝗄𝐻(𝑜)𝐺(𝖱𝖾𝗍𝖥𝗈𝗋𝗄𝐻(𝑜)(𝑠))⎞⎟
⎟
⎟
⎟
⎟⎠⟶(𝖱𝖾𝗍𝖧𝐻(𝑜)⟶𝐺(𝐴))⟶𝐺(𝐴). Given 𝑔𝑋 :𝑋 ⟶𝐺(𝑋) at every 𝑋, its catamorphism is 𝖼𝖺𝗍𝖺𝖧𝑔,𝛼(𝗉𝗎𝗋𝖾(𝑥))=𝑔(𝑥),𝖼𝖺𝗍𝖺𝖧𝑔,𝛼(𝗂𝗆𝗉𝗎𝗋𝖾(𝑜,𝜓,𝑘))=𝛼(𝑜,𝖼𝖺𝗍𝖺𝖧𝑔,𝛼∘𝜓,𝖼𝖺𝗍𝖺𝖧𝑔,𝛼∘𝑘). For 𝐺(𝑋) =𝖥𝗋𝖾𝖾Δ(𝑋) and 𝑔 =𝗉𝗎𝗋𝖾, an algebra 𝐸 is an elaboration and the catamorphism is 𝖾𝗅𝖺𝖻𝗈𝗋𝖺𝗍𝖾𝐸. Component composition is operation-tag dispatch: (𝐸1⋎𝐸2)(𝗂𝗇𝗅𝑜,𝜓,𝑘)=𝐸1(𝑜,𝜓,𝑘),(𝐸1⋎𝐸2)(𝗂𝗇𝗋𝑜,𝜓,𝑘)=𝐸2(𝑜,𝜓,𝑘).
The higher-order catch operation at code 𝑡 has 𝖥𝗈𝗋𝗄𝖢𝖺𝗍𝖼𝗁(𝖼𝖺𝗍𝖼𝗁(𝑡))=(𝟐,𝜆𝑏.𝖵𝖺𝗅(𝑡)),𝖱𝖾𝗍𝖧𝖢𝖺𝗍𝖼𝗁(𝖼𝖺𝗍𝖼𝗁(𝑡))=𝖵𝖺𝗅(𝑡). For a throw insertion witness 𝑤, write ℎ =𝗋𝗎𝗇𝖳𝗁𝗋𝗈𝗐𝑤. Its equations and the residual-operation reinjection are ℎ(𝗉𝗎𝗋𝖾(𝑥))=𝗉𝗎𝗋𝖾(𝗃𝗎𝗌𝗍(𝑥)),ℎ(𝗍𝗁𝗋𝗈𝗐)=𝗉𝗎𝗋𝖾(𝗇𝗈𝗍𝗁𝗂𝗇𝗀),ℎ(𝗋𝖾𝗌(𝑜,𝑘))=𝗂𝗆𝗉𝗎𝗋𝖾(𝑜,𝜆𝑟.ℎ(𝑘(𝑟))),𝗆𝖺𝗌𝗄𝑤(𝗉𝗎𝗋𝖾(𝑥))=𝗉𝗎𝗋𝖾(𝑥),𝗆𝖺𝗌𝗄𝑤(𝗂𝗆𝗉𝗎𝗋𝖾(𝑜,𝑘))=𝗋𝖾𝗌(𝑜,𝜆𝑟.𝗆𝖺𝗌𝗄𝑤(𝑘(𝑟))). The catch component is 𝐸𝖼𝖺𝗍𝖼𝗁(𝖼𝖺𝗍𝖼𝗁(𝑡),̂𝜓,̂𝑘)=𝗆𝖺𝗌𝗄𝑤(ℎ(̂𝜓(𝗍𝗍)))≫=𝗆𝖺𝗒𝖻𝖾(̂𝑘,̂𝜓(𝖿𝖿)≫=̂𝑘). The state component used by the chapter discards the final state: 𝗋𝗎𝗇𝖲𝗍𝖺𝗍𝖾𝑠(𝗉𝗎𝗋𝖾(𝑥))=𝗉𝗎𝗋𝖾(𝑥),𝗋𝗎𝗇𝖲𝗍𝖺𝗍𝖾𝑠(𝗉𝗎𝗍(𝑛,𝑘))=𝗋𝗎𝗇𝖲𝗍𝖺𝗍𝖾𝑛(𝑘(⋆)),𝗋𝗎𝗇𝖲𝗍𝖺𝗍𝖾𝑠(𝗀𝖾𝗍(𝑘))=𝗋𝗎𝗇𝖲𝗍𝖺𝗍𝖾𝑠(𝑘(𝑠)),𝗋𝗎𝗇𝖲𝗍𝖺𝗍𝖾𝑠(𝗋𝖾𝗌(𝑜,𝑘))=𝗂𝗆𝗉𝗎𝗋𝖾(𝑜,𝜆𝑟.𝗋𝗎𝗇𝖲𝗍𝖺𝗍𝖾𝑠(𝑘(𝑟))).