INTRO
The n2o module contains request and context definition, state and N2O functors.
REQUEST
type Req = { path : string
, method : string
, version : string
, headers : (string * string) list
}
fun mkReq () = { path = ""
, method = ""
, version = "HTTP/1.1"
, headers = []
}
CONTEXT
datatype 'a Ev = Init
| Message of 'a
| Terminate
datatype 'a Res = Reply of 'a
| Ok
| Unknown
| Empty
type 'a Cx = { req : Req
, module : 'a Ev -> 'a Res
}
val 'a mod_ : 'a Ev -> 'a Res = fn _ => Empty
signature BASE = sig
type t
type 'a prot
end
signature BASE_EXT = sig
include BASE
val handlers : (t Hnd) list
val protos : ((t prot) Proto) list
end
signature CX = sig
include BASE_EXT
val cx : t Cx
end
functor MkCx (M: BASE_EXT) :> CX = struct
type t = M.t
type 'a prot = 'a M.prot
val cx = { req = mkReq (), module = mod_ }
val handlers = M.handlers
val protos = M.protos
end
IO
type 'a Proto = 'a -> 'a Res
type 'a Hnd = 'a Cx -> 'a Cx
This module may refer to: SERVER