WebPart Module

Types

Type Description

AsyncOptionBuilder

WebPart<'a>

Takes 'a and returns SuaveTask of 'a SuaveTask is also known as AsyncOption

Functions and values

Function or value Description

asyncOption

Full Usage: asyncOption

Returns: AsyncOptionBuilder
  With this workflow you can write WebParts like this
  let task ctx = asyncOption {
    let! _ = GET ctx
    let! ctx = Writers.setHeader "foo" "bar"
    return ctx
  }

  we can still use the old symbol but now has a new meaning
  let foo ctx = GET ctx >>= OK "hello"
Returns: AsyncOptionBuilder

bind f a

Full Usage: bind f a

Parameters:
Returns: Async<'b option>

Classic bind (for SuaveTask)

f : 'a -> Async<'b option>
a : Async<'a option>
Returns: Async<'b option>

choose options

Full Usage: choose options

Parameters:
Returns: WebPart<'a>

Entry-point for composing the applicative routes of the http application, by iterating the options, applying the context, arg, to the predicate from the list of options, until there's a match/a Some(x) which can be run.

options : WebPart<'a> list
Returns: WebPart<'a>

cnst x arg2

Full Usage: cnst x arg2

Parameters:
    x : 't
    arg1 : 'u

Returns: 't
Modifiers: inline
Type parameters: 't, 'u

The constant function, which returns its constant, no matter its input. - theorem: identity = (warbler cnst) (warbler cnst) x = cnst x x = fun _ -> x

x : 't
arg1 : 'u
Returns: 't

compose first second arg3

Full Usage: compose first second arg3

Parameters:
    first : 'a -> Async<'b option>
    second : 'b -> Async<'c option>
    arg2 : 'a

Returns: Async<'c option>

Left-to-right Kleisli composition (for SuaveTask).

first : 'a -> Async<'b option>
second : 'b -> Async<'c option>
arg2 : 'a
Returns: Async<'c option>

concatenate first second arg3

Full Usage: concatenate first second arg3

Parameters:
    first : 'a -> 'b option
    second : 'a -> 'b option
    arg2 : 'a

Returns: 'b option
Modifiers: inline
Type parameters: 'a, 'b
first : 'a -> 'b option
second : 'a -> 'b option
arg2 : 'a
Returns: 'b option

cond item f g arg4

Full Usage: cond item f g arg4

Parameters:
    item : Choice<'T, 'a>
    f : 'T -> 'U -> 'V
    g : 'U -> 'V
    arg3 : 'U

Returns: 'V

The conditional function that applies f x a if there's a value in d, or otherwise, applies g a, if there is no value in d.

item : Choice<'T, 'a>
f : 'T -> 'U -> 'V
g : 'U -> 'V
arg3 : 'U
Returns: 'V

fail

Full Usage: fail

Returns: Async<'a option>
Returns: Async<'a option>

inject postOp pairs

Full Usage: inject postOp pairs

Parameters:
Returns: WebPart<'a>
 Inject a webPart

 +------------+                                            +--------------+
 | url "/a"   +----------+                       +---------+   cont1      |
 +------------+          |                       |         +--------------+
                         |                       |
 +-------------+         |       +----------+    |         +--------------+
 |  url "/b"   +---------+-------+ injected +----+---------+  cont2       |
 +-------------+         |       +----------+    |         +--------------+
                         |                       |
 +-------------+         |                       |         +--------------+
 | url "/b"    +---------+                       +---------+  cont3       |
 +-------------+                                           +--------------+
postOp : WebPart<'a>
pairs : (WebPart<'a> * WebPart<'a>) list
Returns: WebPart<'a>

never

Full Usage: never

Returns: WebPart<'a>
Returns: WebPart<'a>

succeed

Full Usage: succeed

Returns: WebPart<'a>
Modifiers: inline
Type parameters: 'a
Returns: WebPart<'a>

tryThen first second

Full Usage: tryThen first second

Parameters:
Returns: WebPart<'a>
Modifiers: inline
Type parameters: 'a
first : WebPart<'a>
second : WebPart<'a>
Returns: WebPart<'a>

warbler f arg2

Full Usage: warbler f arg2

Parameters:
    f : 't -> 't -> 'u
    arg1 : 't

Returns: 'u
Modifiers: inline
Type parameters: 't, 'u

Which bird? A Warbler! Pipe the request through to a bird that can peck at it. Put another way, using 'warbler' lets you look at the first parameter and then make a decision about what thing to return (it's most likely a WebPart you'll be returning). (Remember, WebPart is HttpContext -> Async) where HttpContext is 'a and Async<_> is 'b.

f : 't -> 't -> 'u
arg1 : 't
Returns: 'u