FSharpx.Extras


  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
136: 
137: 
138: 
139: 
140: 
141: 
142: 
143: 
144: 
145: 
146: 
147: 
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: 
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: 
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: 
174: 
175: 
176: 
177: 
178: 
179: 
180: 
181: 
182: 
183: 
184: 
185: 
186: 
187: 
188: 
189: 
190: 
191: 
192: 
193: 
194: 
195: 
#r "System.Xml.Linq.dll"
//#load "Server.fs"

//open System.IO
//open System.Net
//open System.Text
//open System.Threading
open System.Xml.Linq
//open FSharpx.Control

type Agent<'T> = MailboxProcessor<'T>

// ----------------------------------------------------------------------------

module First = 
  let agent = Agent.Start(fun agent -> async {
    while true do
      let! msg = agent.Receive()
      printfn "Hello %s!" msg })

  agent.Post("Tomas")

type ChatMessage = 
  | GetContent of AsyncReplyChannel<string>
  | SendMessage of string

module Second =
  let agent = Agent<_>.Start(fun agent -> 
    let rec loop messages = async {

      // Pick next message from the mailbox
      let! msg = agent.Receive()
      match msg with 
      | SendMessage msg -> 
          // Add message to the list & continue
          let msg = XElement(XName.Get("li"), msg)
          return! loop (msg :: messages)

      | GetContent reply -> 
          // Generate HTML with messages
          let html = XElement(XName.Get("ul"), messages)
          // Send it back as the reply
          reply.Reply(html.ToString())
          return! loop messages }
    loop [] )

  agent.Post(SendMessage "Welcome to F# chat implemented using agents!")
  agent.Post(SendMessage "This is my second message to this chat room...")

  agent.PostAndReply(GetContent)

// --------------------------------------------------------------------------------------

type ChatRoom() = 
  let agent = Agent.Start(fun agent -> 
    let rec loop messages = async {
      // Pick next message from the mailbox
      let! msg = agent.Receive()
      match msg with 
      | SendMessage msg -> 
          // Add message to the list & continue
          let msg = XElement(XName.Get("li"), msg)
          return! loop (msg :: messages)

      | GetContent reply -> 
          // Generate HTML with messages
          let html = XElement(XName.Get("ul"), messages)
          // Send it back as the reply
          reply.Reply(html.ToString())
          return! loop messages }
    loop [] )
  member x.SendMessage(msg) = agent.Post(SendMessage msg)
  member x.AsyncGetContent(?timeout) = agent.PostAndAsyncReply(GetContent, ?timeout=timeout) 
  member x.GetContent() = agent.PostAndReply(GetContent)

  member x.GetContentAsync() = 
    Async.StartAsTask(agent.PostAndAsyncReply(GetContent))

  member x.GetContentAsync(cancellationToken) = 
    Async.StartAsTask
     ( agent.PostAndAsyncReply(GetContent), 
       cancellationToken = cancellationToken )

let room = new ChatRoom()

room.SendMessage("Welcome to F# chat implemented using agents!")
room.SendMessage("This is my second message to this chat room...")

async { 
  while true do
    do! Async.Sleep(10000)
    let! html = room.AsyncGetContent()
    printfn "%A" html }
|> Async.Start     

// --------------------------------------------------------------------------------------

open System.Net
open System.Threading

[<AutoOpen>]
module HttpExtensions = 

  type System.Net.HttpListener with
    member x.AsyncGetContext() = 
      Async.FromBeginEnd(x.BeginGetContext, x.EndGetContext)

type HttpAgent private (url, f) as this =
  let tokenSource = new CancellationTokenSource()
  let agent = Agent.Start((fun _ -> f this), tokenSource.Token)
  let server = async { 
    use listener = new HttpListener()
    listener.Prefixes.Add(url)
    listener.Start()
    while true do 
      let! context = listener.AsyncGetContext()
      agent.Post(context) }
  do Async.Start(server, cancellationToken = tokenSource.Token)

  member x.Receive(?timeout) = agent.Receive(?timeout = timeout)
  member x.Stop() = tokenSource.Cancel()
  static member Start(url, f) = 
    new HttpAgent(url, f)


open System.IO
open System.Text

[<AutoOpen>]
module HttpExtensions2 = 

  type System.Net.HttpListenerRequest with
    member request.InputString =
      use sr = new StreamReader(request.InputStream)
      sr.ReadToEnd()

  type System.Net.HttpListenerResponse with
    member response.Reply(s:string) = 
      let buffer = Encoding.UTF8.GetBytes(s)
      response.ContentLength64 <- int64 buffer.Length
      let output = response.OutputStream
      output.Write(buffer,0,buffer.Length)
      output.Close()
    member response.Reply(typ, buffer:byte[]) = 
      response.ContentLength64 <- int64 buffer.Length
      let output = response.OutputStream
      response.ContentType <- typ
      output.Write(buffer,0,buffer.Length)
      output.Close()

// --------------------------------------------------------------------------------------

open System.Threading

let server = HttpAgent.Start("http://localhost:8082/", fun server -> async {
  while true do 
    let! ctx = server.Receive()
    ctx.Response.Reply("Hello!") })
  
server.Stop()

let root = @"C:\Tomas\Writing\MSDN\code\2 Server Side\Demo.ChatServer\"

let contentTypes = 
  dict [ ".gif", "binary/image"
         ".css", "text/css"
         ".html", "text/html" 
         ".xap", "application/x-silverlight-app" ]

let server2 = HttpAgent.Start("http://localhost:8082/", fun mbox -> 
  let handleRequest (ctx:HttpListenerContext) = async { 
    match ctx.Request.Url.LocalPath with 
    | "/post" -> 
        // Send message to the chat room
        room.SendMessage(ctx.Request.InputString)
        ctx.Response.Reply("OK")
    | "/chat" -> 
        // Get messages from the chat room (asynchronously!)
        let! text = room.AsyncGetContent()
        ctx.Response.Reply(text)
    | s ->
        // Handle an ordinary file request
        let file = 
          root + (if s = "/" then "chat.html" else s.ToLower())
        if File.Exists(file) then 
          let typ = contentTypes.[Path.GetExtension(file)]
          ctx.Response.Reply(typ, File.ReadAllBytes(file))
        else 
          ctx.Response.Reply(sprintf "File not found: %s" file) }
  async {
    while true do 
      let! ctx = mbox.Receive()
      ctx |> handleRequest |> Async.Start })

server2.Stop()
namespace System
namespace System.Xml
namespace System.Xml.Linq
type Agent<'T> = MailboxProcessor<'T>

Full name: ChatServer.Agent<_>
Multiple items
type MailboxProcessor<'Msg> =
  interface IDisposable
  new : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken:CancellationToken -> MailboxProcessor<'Msg>
  member Post : message:'Msg -> unit
  member PostAndAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> Async<'Reply>
  member PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> 'Reply
  member PostAndTryAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> Async<'Reply option>
  member Receive : ?timeout:int -> Async<'Msg>
  member Scan : scanner:('Msg -> Async<'T> option) * ?timeout:int -> Async<'T>
  member Start : unit -> unit
  member TryPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> 'Reply option
  ...

Full name: Microsoft.FSharp.Control.MailboxProcessor<_>

--------------------
new : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken:System.Threading.CancellationToken -> MailboxProcessor<'Msg>
val agent : MailboxProcessor<string>

Full name: ChatServer.First.agent
static member MailboxProcessor.Start : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken:System.Threading.CancellationToken -> MailboxProcessor<'Msg>
val agent : MailboxProcessor<string>
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val msg : string
member MailboxProcessor.Receive : ?timeout:int -> Async<'Msg>
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
member MailboxProcessor.Post : message:'Msg -> unit
type ChatMessage =
  | GetContent of AsyncReplyChannel<string>
  | SendMessage of string

Full name: ChatServer.ChatMessage
union case ChatMessage.GetContent: AsyncReplyChannel<string> -> ChatMessage
type AsyncReplyChannel<'Reply>
member Reply : value:'Reply -> unit

Full name: Microsoft.FSharp.Control.AsyncReplyChannel<_>
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
union case ChatMessage.SendMessage: string -> ChatMessage
val agent : MailboxProcessor<ChatMessage>

Full name: ChatServer.Second.agent
val agent : MailboxProcessor<ChatMessage>
val loop : (XElement list -> Async<'a>)
val messages : XElement list
val msg : ChatMessage
val msg : XElement
Multiple items
type XElement =
  inherit XContainer
  new : name:XName -> XElement + 4 overloads
  member AncestorsAndSelf : unit -> IEnumerable<XElement> + 1 overload
  member Attribute : name:XName -> XAttribute
  member Attributes : unit -> IEnumerable<XAttribute> + 1 overload
  member DescendantNodesAndSelf : unit -> IEnumerable<XNode>
  member DescendantsAndSelf : unit -> IEnumerable<XElement> + 1 overload
  member FirstAttribute : XAttribute
  member GetDefaultNamespace : unit -> XNamespace
  member GetNamespaceOfPrefix : prefix:string -> XNamespace
  member GetPrefixOfNamespace : ns:XNamespace -> string
  ...

Full name: System.Xml.Linq.XElement

--------------------
XElement(name: XName) : unit
XElement(other: XElement) : unit
XElement(other: XStreamingElement) : unit
XElement(name: XName, content: obj) : unit
XElement(name: XName, [<System.ParamArray>] content: obj []) : unit
type XName =
  member Equals : obj:obj -> bool
  member GetHashCode : unit -> int
  member LocalName : string
  member Namespace : XNamespace
  member NamespaceName : string
  member ToString : unit -> string
  static member Get : expandedName:string -> XName + 1 overload

Full name: System.Xml.Linq.XName
XName.Get(expandedName: string) : XName
XName.Get(localName: string, namespaceName: string) : XName
val reply : AsyncReplyChannel<string>
val html : XElement
member AsyncReplyChannel.Reply : value:'Reply -> unit
XNode.ToString() : string
XNode.ToString(options: SaveOptions) : string
member MailboxProcessor.PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> 'Reply
Multiple items
type ChatRoom =
  new : unit -> ChatRoom
  member AsyncGetContent : ?timeout:int -> Async<string>
  member GetContent : unit -> string
  member GetContentAsync : unit -> Task<string>
  member GetContentAsync : cancellationToken:CancellationToken -> Task<string>
  member SendMessage : msg:string -> unit

Full name: ChatServer.ChatRoom

--------------------
new : unit -> ChatRoom
val x : ChatRoom
member ChatRoom.SendMessage : msg:string -> unit

Full name: ChatServer.ChatRoom.SendMessage
member ChatRoom.AsyncGetContent : ?timeout:int -> Async<string>

Full name: ChatServer.ChatRoom.AsyncGetContent
val timeout : int option
member MailboxProcessor.PostAndAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> Async<'Reply>
member ChatRoom.GetContent : unit -> string

Full name: ChatServer.ChatRoom.GetContent
member ChatRoom.GetContentAsync : unit -> System.Threading.Tasks.Task<string>

Full name: ChatServer.ChatRoom.GetContentAsync
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task -> Async<unit>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken

Full name: Microsoft.FSharp.Control.Async

--------------------
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>
static member Async.StartAsTask : computation:Async<'T> * ?taskCreationOptions:System.Threading.Tasks.TaskCreationOptions * ?cancellationToken:System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
member ChatRoom.GetContentAsync : cancellationToken:System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>

Full name: ChatServer.ChatRoom.GetContentAsync
val cancellationToken : System.Threading.CancellationToken
val room : ChatRoom

Full name: ChatServer.room
member ChatRoom.SendMessage : msg:string -> unit
static member Async.Sleep : millisecondsDueTime:int -> Async<unit>
val html : string
member ChatRoom.AsyncGetContent : ?timeout:int -> Async<string>
static member Async.Start : computation:Async<unit> * ?cancellationToken:System.Threading.CancellationToken -> unit
namespace System.Net
namespace System.Threading
Multiple items
type AutoOpenAttribute =
  inherit Attribute
  new : unit -> AutoOpenAttribute
  new : path:string -> AutoOpenAttribute
  member Path : string

Full name: Microsoft.FSharp.Core.AutoOpenAttribute

--------------------
new : unit -> AutoOpenAttribute
new : path:string -> AutoOpenAttribute
Multiple items
type HttpListener =
  new : unit -> HttpListener
  member Abort : unit -> unit
  member AuthenticationSchemeSelectorDelegate : AuthenticationSchemeSelector with get, set
  member AuthenticationSchemes : AuthenticationSchemes with get, set
  member BeginGetContext : callback:AsyncCallback * state:obj -> IAsyncResult
  member Close : unit -> unit
  member DefaultServiceNames : ServiceNameCollection
  member EndGetContext : asyncResult:IAsyncResult -> HttpListenerContext
  member ExtendedProtectionPolicy : ExtendedProtectionPolicy with get, set
  member ExtendedProtectionSelectorDelegate : ExtendedProtectionSelector with get, set
  ...
  nested type ExtendedProtectionSelector

Full name: System.Net.HttpListener

--------------------
HttpListener() : unit
val x : HttpListener
member HttpListener.AsyncGetContext : unit -> Async<HttpListenerContext>

Full name: ChatServer.HttpExtensions.AsyncGetContext
static member Async.FromBeginEnd : beginAction:(System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
HttpListener.BeginGetContext(callback: System.AsyncCallback, state: obj) : System.IAsyncResult
HttpListener.EndGetContext(asyncResult: System.IAsyncResult) : HttpListenerContext
Multiple items
type HttpAgent =
  private new : url:string * f:(HttpAgent -> Async<unit>) -> HttpAgent
  member Receive : ?timeout:int -> Async<HttpListenerContext>
  member Stop : unit -> unit
  static member Start : url:string * f:(HttpAgent -> Async<unit>) -> HttpAgent

Full name: ChatServer.HttpAgent

--------------------
private new : url:string * f:(HttpAgent -> Async<unit>) -> HttpAgent
val url : string
val f : (HttpAgent -> Async<unit>)
val this : HttpAgent
val tokenSource : CancellationTokenSource
Multiple items
type CancellationTokenSource =
  new : unit -> CancellationTokenSource
  member Cancel : unit -> unit + 1 overload
  member Dispose : unit -> unit
  member IsCancellationRequested : bool
  member Token : CancellationToken
  static member CreateLinkedTokenSource : [<ParamArray>] tokens:CancellationToken[] -> CancellationTokenSource + 1 overload

Full name: System.Threading.CancellationTokenSource

--------------------
CancellationTokenSource() : unit
val agent : MailboxProcessor<HttpListenerContext>
static member MailboxProcessor.Start : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken:CancellationToken -> MailboxProcessor<'Msg>
property CancellationTokenSource.Token: CancellationToken
val server : Async<unit>
val listener : HttpListener
property HttpListener.Prefixes: HttpListenerPrefixCollection
HttpListenerPrefixCollection.Add(uriPrefix: string) : unit
HttpListener.Start() : unit
val context : HttpListenerContext
member HttpListener.AsyncGetContext : unit -> Async<HttpListenerContext>
static member Async.Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
val x : HttpAgent
member HttpAgent.Receive : ?timeout:int -> Async<HttpListenerContext>

Full name: ChatServer.HttpAgent.Receive
member HttpAgent.Stop : unit -> unit

Full name: ChatServer.HttpAgent.Stop
CancellationTokenSource.Cancel() : unit
CancellationTokenSource.Cancel(throwOnFirstException: bool) : unit
static member HttpAgent.Start : url:string * f:(HttpAgent -> Async<unit>) -> HttpAgent

Full name: ChatServer.HttpAgent.Start
namespace System.IO
namespace System.Text
type HttpListenerRequest =
  member AcceptTypes : string[]
  member BeginGetClientCertificate : requestCallback:AsyncCallback * state:obj -> IAsyncResult
  member ClientCertificateError : int
  member ContentEncoding : Encoding
  member ContentLength64 : int64
  member ContentType : string
  member Cookies : CookieCollection
  member EndGetClientCertificate : asyncResult:IAsyncResult -> X509Certificate2
  member GetClientCertificate : unit -> X509Certificate2
  member HasEntityBody : bool
  ...

Full name: System.Net.HttpListenerRequest
val request : HttpListenerRequest
member HttpListenerRequest.InputString : string

Full name: ChatServer.HttpExtensions2.InputString
val sr : StreamReader
Multiple items
type StreamReader =
  inherit TextReader
  new : stream:Stream -> StreamReader + 9 overloads
  member BaseStream : Stream
  member Close : unit -> unit
  member CurrentEncoding : Encoding
  member DiscardBufferedData : unit -> unit
  member EndOfStream : bool
  member Peek : unit -> int
  member Read : unit -> int + 1 overload
  member ReadLine : unit -> string
  member ReadToEnd : unit -> string
  ...

Full name: System.IO.StreamReader

--------------------
StreamReader(stream: Stream) : unit
StreamReader(path: string) : unit
StreamReader(stream: Stream, detectEncodingFromByteOrderMarks: bool) : unit
StreamReader(stream: Stream, encoding: Encoding) : unit
StreamReader(path: string, detectEncodingFromByteOrderMarks: bool) : unit
StreamReader(path: string, encoding: Encoding) : unit
StreamReader(stream: Stream, encoding: Encoding, detectEncodingFromByteOrderMarks: bool) : unit
StreamReader(path: string, encoding: Encoding, detectEncodingFromByteOrderMarks: bool) : unit
StreamReader(stream: Stream, encoding: Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : unit
StreamReader(path: string, encoding: Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : unit
property HttpListenerRequest.InputStream: Stream
StreamReader.ReadToEnd() : string
type HttpListenerResponse =
  member Abort : unit -> unit
  member AddHeader : name:string * value:string -> unit
  member AppendCookie : cookie:Cookie -> unit
  member AppendHeader : name:string * value:string -> unit
  member Close : unit -> unit + 1 overload
  member ContentEncoding : Encoding with get, set
  member ContentLength64 : int64 with get, set
  member ContentType : string with get, set
  member Cookies : CookieCollection with get, set
  member CopyFrom : templateResponse:HttpListenerResponse -> unit
  ...

Full name: System.Net.HttpListenerResponse
val response : HttpListenerResponse
member HttpListenerResponse.Reply : s:string -> unit

Full name: ChatServer.HttpExtensions2.Reply
val s : string
val buffer : byte []
type Encoding =
  member BodyName : string
  member Clone : unit -> obj
  member CodePage : int
  member DecoderFallback : DecoderFallback with get, set
  member EncoderFallback : EncoderFallback with get, set
  member EncodingName : string
  member Equals : value:obj -> bool
  member GetByteCount : chars:char[] -> int + 3 overloads
  member GetBytes : chars:char[] -> byte[] + 5 overloads
  member GetCharCount : bytes:byte[] -> int + 2 overloads
  ...

Full name: System.Text.Encoding
property Encoding.UTF8: Encoding
Encoding.GetBytes(s: string) : byte []
Encoding.GetBytes(chars: char []) : byte []
Encoding.GetBytes(chars: char [], index: int, count: int) : byte []
Encoding.GetBytes(chars: nativeptr<char>, charCount: int, bytes: nativeptr<byte>, byteCount: int) : int
Encoding.GetBytes(s: string, charIndex: int, charCount: int, bytes: byte [], byteIndex: int) : int
Encoding.GetBytes(chars: char [], charIndex: int, charCount: int, bytes: byte [], byteIndex: int) : int
property HttpListenerResponse.ContentLength64: int64
Multiple items
val int64 : value:'T -> int64 (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int64

--------------------
type int64 = System.Int64

Full name: Microsoft.FSharp.Core.int64

--------------------
type int64<'Measure> = int64

Full name: Microsoft.FSharp.Core.int64<_>
property System.Array.Length: int
val output : Stream
property HttpListenerResponse.OutputStream: Stream
Stream.Write(buffer: byte [], offset: int, count: int) : unit
Stream.Close() : unit
member HttpListenerResponse.Reply : typ:string * buffer:byte [] -> unit

Full name: ChatServer.HttpExtensions2.Reply
val typ : string
Multiple items
val byte : value:'T -> byte (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.byte

--------------------
type byte = System.Byte

Full name: Microsoft.FSharp.Core.byte
property HttpListenerResponse.ContentType: string
val server : HttpAgent

Full name: ChatServer.server
type HttpAgent =
  private new : url:string * f:(HttpAgent -> Async<unit>) -> HttpAgent
  member Receive : ?timeout:int -> Async<HttpListenerContext>
  member Stop : unit -> unit
  static member Start : url:string * f:(HttpAgent -> Async<unit>) -> HttpAgent

Full name: ChatServer.HttpAgent
static member HttpAgent.Start : url:string * f:(HttpAgent -> Async<unit>) -> HttpAgent
val server : HttpAgent
val ctx : HttpListenerContext
member HttpAgent.Receive : ?timeout:int -> Async<HttpListenerContext>
property HttpListenerContext.Response: HttpListenerResponse
member HttpListenerResponse.Reply : s:string -> unit
member HttpListenerResponse.Reply : typ:string * buffer:byte [] -> unit
member HttpAgent.Stop : unit -> unit
val root : string

Full name: ChatServer.root
val contentTypes : System.Collections.Generic.IDictionary<string,string>

Full name: ChatServer.contentTypes
val dict : keyValuePairs:seq<'Key * 'Value> -> System.Collections.Generic.IDictionary<'Key,'Value> (requires equality)

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.dict
val server2 : HttpAgent

Full name: ChatServer.server2
val mbox : HttpAgent
val handleRequest : (HttpListenerContext -> Async<unit>)
type HttpListenerContext =
  member Request : HttpListenerRequest
  member Response : HttpListenerResponse
  member User : IPrincipal

Full name: System.Net.HttpListenerContext
property HttpListenerContext.Request: HttpListenerRequest
property HttpListenerRequest.Url: System.Uri
property System.Uri.LocalPath: string
property HttpListenerRequest.InputString: string
val text : string
val file : string
System.String.ToLower() : string
System.String.ToLower(culture: System.Globalization.CultureInfo) : string
type File =
  static member AppendAllLines : path:string * contents:IEnumerable<string> -> unit + 1 overload
  static member AppendAllText : path:string * contents:string -> unit + 1 overload
  static member AppendText : path:string -> StreamWriter
  static member Copy : sourceFileName:string * destFileName:string -> unit + 1 overload
  static member Create : path:string -> FileStream + 3 overloads
  static member CreateText : path:string -> StreamWriter
  static member Decrypt : path:string -> unit
  static member Delete : path:string -> unit
  static member Encrypt : path:string -> unit
  static member Exists : path:string -> bool
  ...

Full name: System.IO.File
File.Exists(path: string) : bool
type Path =
  static val DirectorySeparatorChar : char
  static val AltDirectorySeparatorChar : char
  static val VolumeSeparatorChar : char
  static val InvalidPathChars : char[]
  static val PathSeparator : char
  static member ChangeExtension : path:string * extension:string -> string
  static member Combine : [<ParamArray>] paths:string[] -> string + 3 overloads
  static member GetDirectoryName : path:string -> string
  static member GetExtension : path:string -> string
  static member GetFileName : path:string -> string
  ...

Full name: System.IO.Path
Path.GetExtension(path: string) : string
File.ReadAllBytes(path: string) : byte []
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
Fork me on GitHub