Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Filter by
Sorted by
Tagged with
2 votes
1 answer
76 views

Is there a general way to gain external control over the execution of an arbitrary asynchronous workflow, for suspension and resumption? Akin to a CancellationToken but more like a SuspendResumeToken ...
Bent Rasmussen's user avatar
3 votes
2 answers
570 views

I have been implementing a [<Trace>] attribute for some of our larger .NET solutions that will allow configurable analytics to be easily added to any functions/methods that are considered ...
Aaron M. Eshbach's user avatar
5 votes
3 answers
418 views

I'm trying to understand async workflows in F# but I found one part that I really don't understand. The following code works fine: let asynWorkflow = async{ let! result = Stream.TryOpenAsync(...
KCT's user avatar
  • 287
0 votes
1 answer
260 views

function(dataValue, cb) { req.app.db.models.User.find({ _id: { $ne: dataValue._id } }, function(err, totalUser) { if (!err) { ...
Rahul Dey's user avatar
  • 107
7 votes
1 answer
735 views

I am using a library which has been written in C# and uses the async/await pattern. In C# I can await something by calling it with ConfigureAwait(false) but when I use the library from F# I don't see ...
dustinmoris's user avatar
  • 3,381
2 votes
1 answer
533 views

Suppose I have an async data source: let getData() = async { return [ 3.14; 2.72 ] } I could call it using let! and a temporary label: let showData1() = async { let! data = getData() data ...
Wallace's user avatar
  • 18k
8 votes
1 answer
505 views

I'm trying to make an asynchronous web request to a URL that will return if the request takes too long. I'm using the F# asynchronous workflow and the System.Net.Http library to do this. However, I ...
WiseGuyEh's user avatar
  • 19.1k
1 vote
1 answer
793 views

In writing some code that works with a lot of nested async workflows lately I've found a pattern emerging that smells to me. A simple example: let flip f x y = f y x let slowInc x = async { do! ...
SimonF's user avatar
  • 834
3 votes
0 answers
229 views

Time to embarrass myself again with a lack of understanding of how concurrency works in .NET :P I'm trying to write a function that can encapsulates creating an async workflow that takes an asyncSeq ...
SimonF's user avatar
  • 834
8 votes
1 answer
1k views

I use Async.Catch to handle exceptions thrown by async workflows: work |> Async.Catch |> Async.RunSynchronously |> fun x -> match x with | Choice1Of2 _ -> () // success ...
stmax's user avatar
  • 6,625
16 votes
2 answers
1k views

I'd like to test the following async workflow (with NUnit+FsUnit): let foo = async { failwith "oops" return 42 } I wrote the following test for it: let [<Test>] TestFoo () = foo |> ...
stmax's user avatar
  • 6,625
5 votes
1 answer
2k views

When calling Async.RunSynchronously with a timeout and a CancellationToken, the timeout value seems to be ignored. I can work around this by calling CancelAfter on the CancellationToken, but ideally I'...
Joe Taylor's user avatar
  • 2,205
4 votes
2 answers
938 views

I have stumbled upon a problem when calling a nested Async which happens to be null. An exception is raised but it can't be catched with any of the normal exception handling methods Async workflows ...
Samuel Otter's user avatar
1 vote
2 answers
462 views

I am new to functional programming in general and started learning F# recently. I wanted to use an async workflow returning Async<'U option> to pick an item in a Sequence. I find a nice Seq.pick ...
Charles Prakash Dasari's user avatar
15 votes
1 answer
2k views

What is the Scala equivalent of F#'s async workflows? For example, how would following F# snippet translate to idiomatic Scala? open System.Net open Microsoft.FSharp.Control.WebExtensions let ...
pharoah 121's user avatar
2 votes
2 answers
275 views

I was under the impression that let! in f# was smart enough to excute sequences of assignments in parallell. However, the following sample displays a different behavior, assignment of a,b,c seems to ...
Roger Johansson's user avatar
6 votes
2 answers
2k views

I'm trying to use async workflows in F# to fetch several web requests. However, some of my requests are occasionally returning errors (e.g. http 500), and I don't know how to handle this. It appears ...
jessicah's user avatar
  • 985
4 votes
3 answers
847 views

I am currently working on a server application that needs to control a collection devices over a network. Because of this, we need to do a lot of parallel programming. Over time, I have learned that ...
Dimitri C.'s user avatar
  • 22.7k
58 votes
7 answers
36k views

Is there an asynchronous version of DirectoryInfo.GetFiles / Directory.GetDirectories in dotNet? I'd like to use them in an F# async block, and it'd be nice to have a version that can be called with ...
James Moore's user avatar
  • 9,075
8 votes
2 answers
1k views

Lets say I wanted to scrape a webpage, and extract some data. I'd most likely write something like this: let getAllHyperlinks(url:string) = async { let req = WebRequest.Create(url) ...
Juliet's user avatar
  • 81.7k
4 votes
2 answers
1k views

I am a C# programmer, but I have a question about Async Workflows in F#. Supposing I have the following class in a C# class library: class File { IAsyncResult BeginReadAll(string fileName, ...
skb's user avatar
  • 31.3k
5 votes
4 answers
1k views

You always hear that functional code is inherently easier to parallelize than non-functional code, so I decided to write a function which does the following: Given a input of strings, total up the ...
Juliet's user avatar
  • 81.7k