2016-10-20 69 views
0

我無法看到spray的指令如何對應continuation passing style (CPS)噴霧指令如何對應延續?

更具體地,繼續是(a -> r) -> r(在Haskell),但我不能找到其中是這種類型的((a -> r) -> r)使用噴霧directives(其具有的Route->Route其中type Route = RequestContext => Unit的類型)時。

也不Route->Route既不type Route = RequestContext => Unit確實像(a -> r) -> r,那麼指令如何與CPS

有人可以展示spray的指令correspond延續傳球的風格嗎?

回答

0

一個指令,在其最簡單的形式中,被定義爲

abstract class Directive[L <: HList] { 
    def happly(f: L => Route): Route 
} 

這正是一個(a -> r) -> r。您在噴塗中看到的文檔是一個高級DSL,它在引擎蓋下構建Directive實例。您可以在Directive.scala