如何在CPS中构建更高等级的Coyoneda类型的值?

{-# LANGUAGE RankNTypes #-}

newtype Coyoneda f a = Coyoneda {
  uncoyo :: forall b r. ((b -> a) -> f b -> r) -> r
}

coyoneda f tx = Coyoneda (k -> k f tx)

我认为Coyoneda应该通过模拟具有更高等级类型的存在来工作,但我无法构造这种类型的值。在coyoneda辅助功能不类型检查,因为对于术语k f tx中较高等级类型变量b将难逃其范围。

但是,我无法想出另一种实现coyoneda. 有可能吗?

以上是如何在CPS中构建更高等级的Coyoneda类型的值?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>