Cofree(E e)NonEmptyT(作家 e)

特定

data Either e a = Left e
                | Right a

我们有

data Cofree (Either e) a
     = a :< Left e
     | a :< Right (Cofree (Either e) a)

这是同构的

data Hospitable e a
     = Sorry_AllIHaveIsThis_Here'sWhy a e
     | EatThis a (Hospitable e a)

或者,如果你承诺仅在完成结果后评估日志,则 NonEmptyT (Writer e) a 使用

data NonEmptyT (Writer e) a = NonEmptyT (e,a,[a])