This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace Owin | |
| open System | |
| open System.Collections.Generic | |
| open System.Threading.Tasks | |
| type Request = IDictionary<string, obj> | |
| type Response = string * IDictionary<string, seq<string>> * seq<obj> | |
| type Application = Func<Request, Task<Response>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using NUnit.Framework; | |
| namespace FuncGist { | |
| // signature exposed by middleware and app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Text; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using NUnit.Framework; | |
| namespace FuncGist { | |
| public static class ObservableExtensions { | |
| public static Task Subscribe<T>(this IObservable<T> observable, Action<T> next) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // [snippet: Async socket server using F# async computations.] | |
| open System | |
| open System.IO | |
| open System.Net | |
| open System.Net.Sockets | |
| open System.Threading | |
| type Socket with | |
| member socket.AsyncAccept() = Async.FromBeginEnd(socket.BeginAccept, socket.EndAccept) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Parser<'r, 's> = 's -> Async<('r * 's) option> | |
| let returnF v : Parser<'r,'s> = fun input -> async { return Some(v, input) } | |
| let bind (p: Parser<'a,'s>) (f: 'a -> Parser<'b,'s>) : Parser<'b,'s> = | |
| fun input -> async { | |
| let! comp = p input | |
| return! match comp with | |
| | Some(value, input) -> f value input | |
| | None -> async { return None } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main | |
| open System | |
| open System.Collections.Generic | |
| open System.Net | |
| open System.Net.Http | |
| open Microsoft.ServiceModel.Http | |
| open FSharp.Http | |
| [<EntryPoint>] | |
| let main(args) = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module My.Blogs | |
| open System | |
| open System.Collections.Generic | |
| open System.Web | |
| open IntelliFactory.WebSharper.Sitelets | |
| type Id = int | |
| type Html = string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| namespace Kayak.Http | |
| { | |
| public class HttpRequestEventArgs : EventArgs | |
| { | |
| public IHttpServerRequest Request { get; internal set; } | |
| public IHttpServerResponse Response { get; internal set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let myApp = function | |
| | GET "/" _ -> render "Hello world!" | |
| | POST "/order" p -> frank { | |
| createThingFromParams p | |
| do! redirectTo "/" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type O<'T>(v : 'T, isSet : bool) = | |
| struct | |
| static member op_Implicit(value) : O<'T> = O(value, true) | |
| member this.ValueOrDefault(defaultValue) = if isSet then v else defaultValue | |
| end | |
| module O = | |
| let get (o : O<_>) v = o.ValueOrDefault v | |
| type Optional = System.Runtime.InteropServices.OptionalAttribute | |