Skip to content

Instantly share code, notes, and snippets.

@Tarmil
Last active June 24, 2020 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tarmil/dd82028d09703d4944d58160e8ce4404 to your computer and use it in GitHub Desktop.
Save Tarmil/dd82028d09703d4944d58160e8ce4404 to your computer and use it in GitHub Desktop.
open System.IO
open System.Threading.Tasks
open FSharp.Control.Tasks.TaskBuilder
open FSharp.Control.Tasks.V2
type UnitTaskBuilder() =
inherit TaskBuilderV2()
member _.Run(x) = base.Run(x) :> Task
let utask = UnitTaskBuilder()
let x: Task = utask {
use r = new StreamReader("foo.txt")
let! content = r.ReadToEndAsync()
printfn "%s" content
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment