An asynchronous sequence is similar to the seq
Posted: 13 years ago by Tomas Petricek
This snippet shows the implementation of three HTTP proxy servers in F#. The first is written using simple synchronous style (that isn't scalable). The second version uses event-based approach in the Node.js style, but is difficult to write. The third version uses F# async workflows and is both scalable and easy to write.
7 people like thisPosted: 13 years ago by Tomas Petricek
This snippet demonstrates programming using asynchronous sequences. It contains (hidden) implementation of AsyncSeq type and combinators for working with it. More importantly, it demonstrates how to use asynchronous sequences to implement a simple sequential on-demand crawler.
10 people like thisPosted: 13 years ago by Tomas Petricek
Agent that keeps a cache of web pages that were downloaded previously. The agent handles messages to add and get data as well as message to clear the cache.
7 people like thisPosted: 12 years ago by Tomas Petricek
An agent is used to act as SMTP server and receive emails. Another agent receives emails from the SMTP server and also responds to requests for all emails received. A type is exposed that wraps this behaviour in a single method to get the list of emails.
5 people like thisPosted: 8 years ago by Nick Lydon
Convenient CEs that allow you to measure how long it takes to execute a given content.
5 people like thisPosted: 2 years ago by Natalie Perret
The snippet demonstrates how to compose simple asynchronous functions and how to use try .. with to handle exceptions in asynchronous workflows.
35 people like thisPosted: 13 years ago by Tomas Petricek
This snippet shows two improvements to asynchronous HTTP proxy from: http://fssnip.net/6e. First extension is to process page in chunks (instead of downloading the entire content first). The second extension is to use simple agent-based in-memory cache for previously visited pages.
7 people like thisPosted: 13 years ago by Tomas Petricek
The snippet uses asynchronous sequences (from F# AsyncExtensions) to download historical stock data from Yahoo. Data is downloaded in a buffered way on demand (as needed) and returned line by line. The sample then prints OHLC values for first 30 items.
6 people like thisPosted: 13 years ago by Tomas Petricek
Implementation of Async.Sleep in f# 2.0 doesn't allow break it execution until the time elapsed. Here is the alternate implementation which support immediate cancellation. According to discussion http://stackoverflow.com/questions/9041491/is-there-any-reason-why-async-sleep-can-not-be-canceled-immediately .
2 people like thisPosted: 12 years ago by Andrei Kolomentsev
The Microsoft tutorial Walkthrough: Creating an Asynchronous HTTP Handler did not describe how to use IHttpAsyncHandler from F#.
It was also a bit complicated, because it did not show how to do it from Visual Studio.
Here is the Visual Studio F# version.
1. Create empty ASP.NET Web Application. Call it FSharpHttpAsyncHandler.
2. Add a F# library project to the solution. Call it FSharpHttpAsyncHandler.Lib.
3. Add the following code to Library1.fs in FSharpHttpAsyncHandler.Lib
4. Add a reference to System.Web in FSharpHttpAsyncHandler.Lib
5. Add a reference to FSharpHttpAsyncHandler.Lib in FSharpHttpAsyncHandler.
6. Add the following to Web.config in FSharpHttpAsyncHandler.
7. In the Web tab of the project properties of FSharpHttpAsyncHandler, set Start url to http://localhost:
Posted: 6 years ago by Erling Hellenäs