自由身份(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