免費(作家 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
。