Example #1
0
        public void ToAsync()
        {
            FSharpAsync <int>  a = L.F(() => 1).ToFSharpAsync();
            FSharpAsync <Unit> b = a.IgnoreResult();

            // super verbose return
            FSharpAsync <int> i = ExtraTopLevelOperators.DefaultAsyncBuilder.Return(1);

            FSharpAsync <int>         x  = FSharpAsyncEx.Return(1);
            FSharpAsync <Func <int> > fa = FSharpAsyncEx.Return(L.F(() => 1));
        }
Example #2
0
        public void Example()
        {
            var urls = FSharpList.Create(
                "http://www.google.com"
                , "http://www.bing.com"
                , "http://www.yahoo.com"
                , "http://www.microsoft.com"
                );
            var realJoinWebPages = JoinWebPages(url => Get(url).Protect());
            var testJoinWebPages = JoinWebPages(_ => FSharpAsyncEx.Return(FSharpChoice.New1Of2 <string, Exception>("hello")));
            var result           = testJoinWebPages(urls);

            Assert.AreEqual("hellohellohellohello", result);
        }