Edda
Types
Method
type Method =
| GET
| POST
| PUT
| DELETE
| PATCH
| OPTIONS
| HEAD
| Custom StringStandard HTTP methods, with an escape hatch for non-standard verbs.
Request
record Request {
method: Method,
path: String,
original_path: String,
params: Dict String String,
headers: List (String, String),
body: Maybe BitString
}The framework's view of an HTTP request.
path reflects the current matcher's view — inside a group, it has the
matched prefix stripped. original_path is always the unmodified path
from the wire, useful for logging and correlation.
Effects
Skip
effect Skip {
fun skip : Unit -> a
}Values
not_found
fun not_found : ResponseFunctions
method_str
fun method_str : Method -> Stringparam
fun param : String -> Request -> Maybe StringLook up a captured path parameter by name.
route
fun route : Method -> String -> Request -> Response -> Request -> Response needs {Skip, ..e}Build a route. If method matches and the pattern fully consumes the path
(capturing any :name segments into params), the handler runs; otherwise
the route skips to let the next route try.
choose
fun choose : List (Request -> Response needs {Skip, ..e}) -> Request -> Responsegroup
fun group : String -> List (Request -> Response needs {Skip, ..e}) -> Request -> Response needs {Skip, ..e}Match a path prefix and run the inner routes against the remainder.
Captured :name params accumulate and are visible to sub-routes.
mount
fun mount : String -> Request -> Response -> Request -> Response needs {Skip}Mount a sub-app whose effects are already handled. Captured :name
params accumulate and are visible to the sub-app.
from_http
fun from_http : Http.Request -> RequestLift a SagaHttp.Http.Request into an Edda.Request.
to_handler
fun to_handler : Request -> Response -> Http.Request -> ResponseAdapt an Edda app to the Request -> Response shape SagaHttp.serve
expects. Use as: serve config (to_handler app).