Wire.bend checks
raw source on the hub · import 0xfdfa1bd0e55846c1e77720b33fca8def/Wire.bend as Wire
1 import
import Base
Types
type wr.H source · line 23 · raw
Data
wr.H@name:String -> @value:String -> wr.H
type wr.Two source · line 27 · raw
Data
two strings (a pair of them is a Type, not Data, so no Maybe holds one)
wr.Two@a:String -> @b:String -> wr.Two
type wr.Q source · line 32 · raw
Data
a query's parameter: its key and value, %-decoded ("+" a space); a key with no "=" has no value
wr.Q@key:String -> @value:Maybe<&2, String> -> wr.Q
type wr.Req source · line 39 · raw
Data
A request: method, version, path (wai's pathInfo: the target's path cut at every "/", the first "" dropped, each %-decoded; "/" is []), the path as sent (before "?"), the query, headers (names in lower case), body, and the peer's address ("" not known).
wr.Req@method:String -> @version:String -> @path:List<&2, String> -> @raw:String -> @query:List<&2, wr.Q> -> @headers:List<&2, wr.H> -> @body:List<&2, U32> -> @peer:String -> wr.Req
type wr.Cut source · line 45 · raw
Data
Where a request's head ends: not yet (the bytes so far, reversed, and how much of "\r\n\r\n" ends them), or the head (with its "\r\n\r\n") and the bytes after it.
wr.More@rev:List<&2, U32> -> @seen:U32 -> wr.Cut
wr.Head@head:List<&2, U32> -> @rest:List<&2, U32> -> wr.Cut
type wr.U8 source · line 51 · raw
Data
a UTF-8 read so far: continuation bytes still wanted, the code so far, the characters read (reversed)
wr.U8@need:U32 -> @code:U32 -> @out:String -> wr.U8
type wr.Body source · line 56 · raw
Data
A body: text (sent as UTF-8), bytes, or size bytes of a file from off,
read as they are sent.
wr.Text@s:String -> wr.Body
wr.Bytes@bs:List<&2, U32> -> wr.Body
wr.File@path:String -> @off:U32 -> @size:U32 -> wr.Body
type wr.Resp source · line 61 · raw
Data
wr.Resp@status:U32 -> @headers:List<&2, wr.H> -> @body:wr.Body -> wr.Resp
type wr.P source · line 337 · raw
Data
A %-read so far: the bytes it lets out now, and where it is: 0 in plain text, 1 after a "%", 2 after a "%" and one more character (hi); plus: a "+" is a space.
wr.P@out:List<&2, U32> -> @st:U32 -> @hi:U32 -> @plus:Bool -> wr.P
Definitions
def wr.if source · line 66 · raw
@-A:Data -> @b:Bool -> @t:(@_:Unit -> A) -> @e:(@_:Unit -> A) -> A
a choice whose branches are computed only when taken (Bool.pick computes both)
def wr.want source · line 77 · raw
@+seen:U32 -> U32
the byte "\r\n\r\n" wants after seen of it
def wr.next source · line 81 · raw
@+seen:U32 -> @+b:U32 -> U32
how much of "\r\n\r\n" the bytes end in, after one more
def wr.cut.at source · line 84 · raw
@done:Bool -> @rev:List<&2, U32> -> @+seen:U32 -> @+rest:List<&2, U32> -> @more:(@_:List<&2, U32> -> @_:U32 -> wr.Cut) -> wr.Cut
def wr.cut source · line 92 · raw
@bs:List<&2, U32> -> @rev:List<&2, U32> -> @+seen:U32 -> wr.Cut
The bytes bs, after rev (reversed) which ended in seen of "\r\n\r\n".
def wr.feed source · line 100 · raw
@c:wr.Cut -> @bs:List<&2, U32> -> wr.Cut
More bytes come.
def wr.latin1 source · line 111 · raw
@bs:List<&2, U32> -> String
bytes as Latin-1 (a head is ASCII)
def wr.u8.onto.at source · line 118 · raw
@one:Bool -> @two:Bool -> @three:Bool -> @+c:U32 -> @out:List<&2, U32> -> List<&2, U32>
def wr.u8.onto source · line 130 · raw
@+c:U32 -> @out:List<&2, U32> -> List<&2, U32>
a character's UTF-8, onto the bytes after it
def wr.utf8.of source · line 134 · raw
@s:String -> List<&2, U32>
a string's UTF-8
def wr.utf8.len source · line 142 · raw
@s:String -> @+n:U32 -> U32
how many bytes a string's UTF-8 is
def wr.u8.lead.at source · line 151 · raw
@l1:Bool -> @l2:Bool -> @l3:Bool -> @l4:Bool -> @l5:Bool -> @+b:U32 -> Pair(U32, U32)
UTF-8 read: need continuation bytes still wanted for code; a byte that
breaks a sequence ends it as U+FFFD
def wr.u8.lead source · line 166 · raw
@+b:U32 -> Pair(U32, U32)
def wr.u8.put.at source · line 169 · raw
@done:Bool -> @bad:Bool -> @+code:U32 -> @out:String -> String
def wr.u8.put source · line 178 · raw
@+need:U32 -> @+code:U32 -> @out:String -> String
def wr.u8.end source · line 182 · raw
@done:Bool -> @out:String -> String
a sequence cut short at the end is U+FFFD
def wr.u8.state source · line 189 · raw
@+need:U32 -> U32
def wr.u8.began source · line 192 · raw
@+n2:U32 -> @+c2:U32 -> @out:String -> wr.U8
def wr.u8.lead.of source · line 195 · raw
@lc:Pair(U32, U32) -> @out:String -> wr.U8
def wr.u8.step.at source · line 200 · raw
@lead:Bool -> @cont:Bool -> @+need:U32 -> @+code:U32 -> @+b:U32 -> @out:String -> wr.U8
def wr.u8.step source · line 209 · raw
@st:wr.U8 -> @+b:U32 -> wr.U8
def wr.u8.fin source · line 214 · raw
@st:wr.U8 -> String
def wr.u8.go source · line 219 · raw
@bs:List<&2, U32> -> @st:wr.U8 -> String
def wr.utf8 source · line 227 · raw
@bs:List<&2, U32> -> String
bytes read as UTF-8
def wr.drop.cr.go source · line 233 · raw
@cs:List<&2, Char> -> List<&2, Char>
def wr.drop.cr source · line 240 · raw
@s:String -> String
def wr.break.cons source · line 243 · raw
@+h:Char -> @m:Maybe<&2, wr.Two> -> Maybe<&2, wr.Two>
def wr.break.at source · line 251 · raw
@hit:Bool -> @+h:Char -> @t:String -> @more:(@_:String -> Maybe<&2, wr.Two>) -> Maybe<&2, wr.Two>
s split at the first c: before, after (Nothing when no c)
def wr.break source · line 258 · raw
@s:String -> @+c:U32 -> Maybe<&2, wr.Two>
def wr.header.got source · line 265 · raw
@m:Maybe<&2, wr.Two> -> Maybe<&2, wr.H>
def wr.header.of source · line 272 · raw
@+line:String -> Maybe<&2, wr.H>
def wr.opt.cons source · line 275 · raw
@m:Maybe<&2, wr.H> -> @rest:List<&2, wr.H> -> List<&2, wr.H>
def wr.headers source · line 282 · raw
@ls:List<&2, String> -> List<&2, wr.H>
def wr.target.got source · line 290 · raw
@+t:String -> @m:Maybe<&2, wr.Two> -> wr.Two
The request line's target: its path and its query ("" none)
def wr.target source · line 297 · raw
@+t:String -> wr.Two
def wr.header source · line 301 · raw
@hs:List<&2, wr.H> -> @+name:String -> String
A header's value ("" none: the first named so)
def wr.has.header source · line 308 · raw
@hs:List<&2, wr.H> -> @+name:String -> Bool
def wr.length source · line 316 · raw
@+hs:List<&2, wr.H> -> U32
how long its body says it is (0 when it does not say)
def wr.hexv.at source · line 320 · raw
@a:Bool -> @b:Bool -> @c2:Bool -> @d:Bool -> @e:Bool -> @f:Bool -> @+c:U32 -> Maybe<&2, U32>
%-decoding (and "+" as a space, as a query has it), to bytes
def wr.hexv source · line 331 · raw
@+c:U32 -> Maybe<&2, U32>
def wr.pct.plain.at source · line 341 · raw
@pct:Bool -> @sp:Bool -> @+c:U32 -> @out:List<&2, U32> -> @+plus:Bool -> wr.P
a character in plain text
def wr.pct.plain source · line 350 · raw
@+c:U32 -> @out:List<&2, U32> -> @+plus:Bool -> wr.P
def wr.pct.pair source · line 354 · raw
@a:Maybe<&2, U32> -> @b:Maybe<&2, U32> -> @+hi:U32 -> @+c:U32 -> @+plus:Bool -> wr.P
the second hex digit: the byte, or what came as it came
def wr.pct.step.at source · line 361 · raw
@zero:Bool -> @one:Bool -> @+hi:U32 -> @+c:U32 -> @+plus:Bool -> wr.P
def wr.pct.step source · line 370 · raw
@p:wr.P -> @+c:U32 -> wr.P
def wr.pct.flush source · line 376 · raw
@p:wr.P -> List<&2, U32>
what a read that ends now lets out still
def wr.pct.emit source · line 381 · raw
@p:wr.P -> @k:(@_:wr.P -> List<&2, U32>) -> List<&2, U32>
def wr.pct.go source · line 386 · raw
@cs:List<&2, Char> -> @p:wr.P -> List<&2, U32>
def wr.pct source · line 394 · raw
@+s:String -> @+plus:Bool -> String
s %-decoded, then read as UTF-8
def wr.segs.tail source · line 398 · raw
@ss:List<&2, String> -> List<&2, String>
The path's segments
def wr.segs.fix source · line 405 · raw
@ss:List<&2, String> -> List<&2, String>
def wr.segs.dec source · line 412 · raw
@ss:List<&2, String> -> List<&2, String>
def wr.segs source · line 419 · raw
@+p:String -> List<&2, String>
def wr.q.got source · line 423 · raw
@+kv:String -> @m:Maybe<&2, wr.Two> -> wr.Q
The query's parameters
def wr.q.one source · line 430 · raw
@empty:Bool -> @+kv:String -> @rest:List<&2, wr.Q> -> List<&2, wr.Q>
def wr.q.go source · line 437 · raw
@kvs:List<&2, String> -> List<&2, wr.Q>
def wr.query source · line 444 · raw
@+q:String -> List<&2, wr.Q>
def wr.param source · line 449 · raw
@qs:List<&2, wr.Q> -> @+name:String -> Maybe<&2, String>
a parameter's value: None when it is missing or has no "=" (as servant's QueryParam reads it)
def wr.req.make source · line 456 · raw
@+m:String -> @+v:String -> @pq:wr.Two -> @hs:List<&2, wr.H> -> Maybe<&2, wr.Req>
def wr.req.line source · line 461 · raw
@ws:List<&2, String> -> @hs:List<&2, wr.H> -> Maybe<&2, wr.Req>
def wr.req.lines source · line 468 · raw
@ls:List<&2, String> -> Maybe<&2, wr.Req>
def wr.req source · line 477 · raw
@head:List<&2, U32> -> Maybe<&2, wr.Req>
A head (its bytes, "\r\n\r\n" in): the request, body still empty, if it reads.
def wr.req.with source · line 481 · raw
@r:wr.Req -> @body:List<&2, U32> -> @peer:String -> wr.Req
the request with its body and peer
def wr.keep source · line 488 · raw
@+v:String -> @+hs:List<&2, wr.H> -> Bool
whether the connection stays open after this request: HTTP/1.1 unless it says Connection: close
def wr.reason.more.at source · line 494 · raw
@a:Bool -> @b:Bool -> @c:Bool -> @d:Bool -> @e:Bool -> String
def wr.reason.more source · line 509 · raw
@+s:U32 -> String
def wr.reason.at source · line 512 · raw
@a:Bool -> @b:Bool -> @c:Bool -> @d:Bool -> @e:Bool -> @f:Bool -> @+s:U32 -> String
def wr.reason source · line 529 · raw
@+s:U32 -> String
def wr.body.len source · line 532 · raw
@b:wr.Body -> Pair(wr.Body, U32)
def wr.headers.text source · line 541 · raw
@hs:List<&2, wr.H> -> String
def wr.conn.line source · line 548 · raw
@keep:Bool -> String
def wr.head source · line 556 · raw
@+status:U32 -> @hs:List<&2, wr.H> -> @+n:U32 -> @keep:Bool -> String
the head of a response with a body of n bytes
def wr.json source · line 563 · raw
@+status:U32 -> @body:String -> wr.Resp
def wr.text source · line 566 · raw
@+status:U32 -> @body:String -> wr.Resp
def wr.with source · line 569 · raw
@r:wr.Resp -> @h:wr.H -> wr.Resp
def wr.App source · line 579 · raw
Type
An application: a request answered (it may read and change the world). A middleware: an application made from another.
def wr.Mid source · line 582 · raw
Type
def wr.mid.id source · line 585 · raw
wr.Mid
def wr.mid.then source · line 588 · raw
@f:wr.Mid -> @g:wr.Mid -> wr.Mid
def wr.req.method source · line 594 · raw
@r:wr.Req -> String
def wr.req.path source · line 599 · raw
@r:wr.Req -> List<&2, String>
def wr.req.raw source · line 604 · raw
@r:wr.Req -> String
def wr.req.query source · line 609 · raw
@r:wr.Req -> List<&2, wr.Q>
def wr.req.headers source · line 614 · raw
@r:wr.Req -> List<&2, wr.H>
def wr.req.body source · line 619 · raw
@r:wr.Req -> List<&2, U32>
def wr.req.peer source · line 624 · raw
@r:wr.Req -> String
def wr.split.cons source · line 631 · raw
@+b:U32 -> @p:Pair(List<&2, U32>, List<&2, U32>) -> Pair(List<&2, U32>, List<&2, U32>)
A connection's bytes after a head: the body (its first n bytes, the Content-Length) and what follows it, the next request's
def wr.split source · line 636 · raw
@n:Nat -> @bs:List<&2, U32> -> Pair(List<&2, U32>, List<&2, U32>)