我看不出spray的指令如何与continuation passing style (CPS)相对应。
更具体地说,延续是(a -> r) -> r (在Haskell中),但我在使用spray directives时找不到这种类型((a -> r) -> r) (它的类型为Route->Route where type Route = RequestContext => Unit)。
type Route = RequestContext => Unit和Route->Route都不像(a -> r) -> r,那么指令和CPS有什么关系呢?
谁能展示一下spray的指令correspond是如何继续传递的?
发布于 2016-10-24 20:26:23
最简单的指令定义为
abstract class Directive[L <: HList] {
def happly(f: L => Route): Route
}它就是一个(a -> r) -> r。您在spray directives文档中看到的是一个高级Directive,它在幕后构建DSL实例。您可以在Directive.scala中查看完整的定义
https://stackoverflow.com/questions/40164470
复制相似问题