自由身份(Nat)作家 Nat
特定
data Identity a = Identity a
我們有
data Free Identity a
= Pure a
| Free (Identity (Free Identity a))
這是同構的
data Deferred a
= Now a
| Later (Deferred a)
或等效地(如果你承諾首先評估 fst 元素)(Nat, a)
,aka Writer Nat a
,with
data Nat = Z | S Nat
data Writer Nat a = Writer Nat a