anchor.diff:                  | Some lastId -> id <> lastId)
               |> Seq.map (fun (id, msg) -> id.ToString(), msg)
               |> Seq.toArray |> channel.Reply
  +        /// Loops forever. Holds the messages seen so far and the currently
  +        /// waiting client channels in its closure.
           let rec loop msgs waiting =
               async {
  +                // Asynchronously waits for the next command.
                   let! command = inbox.Receive()
                   match command with
  +                // Processes a request from a client for new messages.
                   | GetSince(lastId, channel) ->
                       match List.tryHead msgs with
  +                    // If there are new messages since the client last saw anything
  +                    // we immediately respond with those new messages.
                       | Some(id, _) when Some id <> lastId ->
                           notify msgs (lastId, channel)
                           return! loop msgs waiting
  +                    // Otherwise, we wait for something to happen.
                       | Some _ | None ->
                           return! loop msgs ((lastId, channel) :: waiting)
  +                // Processes a request from a client to distribute a new message
                   | Send msg ->
  +                    // Assigns the message an identifier.
                       let id = Guid.NewGuid()
                       let newMsgs = (id, msg) :: msgs
  +                    // Notifies all waiting clients.
                       waiting |> List.iter (notify newMsgs)
                       return! loop newMsgs []
               }
           loop [] []
       )
   
  +/// Creates a Chat API.
   let createServer() =
  +    // Here we define what the server will listen to.
       Website.At "http://*:8080/"
  +    // Here we specify all the routes the server will handle.
       |> Website.WithRouteHandlers 
           [
  +            // All handlers are of the form <ContentType>.<HttpMethod> { Handler }
               Json.POST "/messages" { 
  +                // Resource, Action & Description are published in the
  +                // metadata. They help describe the API for the HashBangAPI type provider.
                   Resource = "Message"; Action = "Send"
                   Description = "Broadcasts a new message."
  +                // A POST handle takes a typed message and asynchronously returns
  +                // a response. The second curried parameter accepts unit because
  +                // there are no parameters in the route path.
                   Handle = fun (message : Message, ()) () -> async {
                       messageBox.Post(Send message)
                       return OK message
  +                }
  +            }
  +
  +            Json.GET "/messages/since/{id:%s}" {
  +                Resource = "Message"; Action = "GetSince"
  +                Description = "Returns all the messages since the given id."
  +                // A GET handle accepts a unit as the first parameter (except
  +                // in more complex cases where things like authentication are involved).
  +                // The second curried parameter accepts a string, as this is a specified
  +                // parameter in the route path "{id:%s}".
  +                Handle = fun () lastId -> async {
  +                    let! msgs = messageBox.PostAndTryAsyncReply(fun c -> 
  +                                    GetSince(Some(Guid.Parse lastId), c))
  +                    return OK msgs
                   }
               }
   
  
positive.code: open TypeInferred.HashBang
  open ChatExample.Shared
  
  type MessageBoxCommand =
      | Send of Message
      | GetSince of Guid option * AsyncReplyChannel<(string * Message)[]>
  
  module List =
      let tryHead = function
          | [] -> None
          | x::_ -> Some x
  
  let messageBox =
      MailboxProcessor.Start(fun inbox ->
          let notify msgs (lastId, channel : AsyncReplyChannel<_>) =
              msgs |> Seq.takeWhile (fun (id, _) -> 
                  match lastId with
  
negative.code:                     return OK msgs
                  }
              }
          ] 
      // Here we specify that the API should publish metadata.
      // This allows us to hook into the API in a type safe way from the
      // HashBangAPI type provider in .NET and FunScript/JS clients. 
      |> Website.WithMetadata
      // This runs the server.
      |> Website.Start
  
  [<EntryPoint>]
  