Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有
D
T
l : D T -> T D
我怎样才能定义comonad D T?
D T
你不能。假设D是恒等式单子并且T是Cont Void,即空类型的延续单子。
Cont Void
newtype D a = D {runD :: a} newtype T a = T {runT :: (a -> Void) -> Void}
然后分配性微不足道。但extract :: D (T a) -> a不能定义为一个完全可计算的程序。这将是双重否定消除forall a. ((a -> Void) -> Void) -> a,这在建设性语言中是无法定义的。
extract :: D (T a) -> a
forall a. ((a -> Void) -> Void) -> a