Project Description

Bistro FSharp extensions is an addin for the Bistro MVC framework that builds web applications and services using F#

FSharpExtensions takes advantage of bistro's compositional nature, and uses F# Quotations to minimize the amount of markup you need on your controllers. Controllers are defined as F# functions, and the rest is inferred from the function's parameters and return values. As an example - here's all you need to build a web service that returns a list of fibonacci numbers:

let rec fibonacci a b rem =
    if (rem = 0) then [a]
    else [a] @ fibonacci b (a+b) (rem-1)
 
[<ReflectedDefinition>]
[<Bind("get /fib/{numbers}")>]
[<RenderWith(@"Templates\fibResult.django")>]
let fibCt (ctx: IExecutionContext) numbers =
    let fibNbrs = fibonacci 0 1 numbers
    fibNbrs


Documentation

  • FSharpExtensions documentation is located here
  • General Bistro documentation is located here

Last edited Jun 4, 2009 at 4:06 AM by kolosy, version 3