免费(作家 w)作家 w
特定
data Writer w a = Writer w a
我们有
data Free (Writer w) a
= Pure a
| Free (Writer w (Free (Writer w) a))
这是同构的
data ProgLog w a
= Done a
| After w (ProgLog w a)
或者,等效地(如果你承诺首先评估日志),Writer [w] a
。
特定
data Writer w a = Writer w a
我们有
data Free (Writer w) a
= Pure a
| Free (Writer w (Free (Writer w) a))
这是同构的
data ProgLog w a
= Done a
| After w (ProgLog w a)
或者,等效地(如果你承诺首先评估日志),Writer [w] a
。