Playing with async sequences

Attempt to reimplement functions AsyncRead/AsyncReadLines from 'Rx on the server ' articles (by Jeffrey van Gogh) using idea of AsyncSequence (by Tomas Petricek)

Copy Source
Copy Link
Tools:
  1: type AsyncSeq<'T> = Async<Chunk<'T>> 
  2: and Chunk<'T> = 
  3:     | Done
  4:     | Value of 'T * AsyncSeq<'T>
  5:  
  6: module AsyncSeq =
  7:     let map f (seq : AsyncSeq<_>) : AsyncSeq<_> = 
  8:         let rec doMap s = async {
  9:             let! chunk = s
 10:             match chunk with
 11:             | Done -> return Done
 12:             | Value (v, next) -> return Value (f v, doMap next)
 13:             }
 14:         doMap seq
 15:     
 16:     let run action (seq : AsyncSeq<_>) = 
 17:         let rec doRun s = async {
 18:             let! chunk = s
 19:             match chunk with
 20:             | Done -> return ()
 21:             | Value (v, next) -> action v; return! doRun next
 22:             }
 23:         doRun seq
 24: 
 25:     let filter f (seq : AsyncSeq<_>) : AsyncSeq<_> =
 26:         let rec doFilter s = async { 
 27:             let! chunk = s
 28:             match chunk with
 29:             | Value (value, next) -> 
 30:                 if f value then return Value(value, doFilter next)
 31:                 else return! doFilter next
 32:             | x -> return x
 33:             }
 34:         doFilter seq
 35: 
 36: [<AutoOpen>]
 37: module AsyncSeqExtensions = 
 38:     
 39:     open System.Text
 40: 
 41:     type System.IO.Stream with
 42:         member this.AsyncReadSeq(?bufferSize) : AsyncSeq<byte[]> = 
 43:             let bufferSize = defaultArg bufferSize (2 <<< 16)
 44:             let temp : byte[] = Array.zeroCreate bufferSize
 45:             let rec doRead () = async {
 46:                 let! count = this.AsyncRead(temp, 0, bufferSize)
 47:                 if count = 0 then return Done
 48:                 else 
 49:                     let buf = Array.sub temp 0 count
 50:                     return Value(buf, doRead ())
 51:                 }
 52:             doRead ()
 53:         
 54:         member this.AsyncReadLines(?bufferSize) = 
 55:             let sb = StringBuilder()
 56:             let getText = AsyncSeq.map Encoding.UTF8.GetString
 57: 
 58:             let rec doRead (s : AsyncSeq<string>) = async {
 59:                 let! chunk = s
 60:                 match chunk with
 61:                 | Done -> 
 62:                     if sb.Length <> 0 then return Value(sb.ToString(), async.Return Done )
 63:                     else return Done
 64:                 | Value(part, next) -> 
 65:                     return! doProcess part 0 next
 66:                 }
 67:             and doProcess (text : string) n next = async {
 68:                 let (|Chars|) pos = 
 69:                     if pos < text.Length - 1 then text.[pos], Some (text.[pos + 1])
 70:                     else text.[pos], None
 71:                 
 72:                 let getLine newPos = 
 73:                     let line = sb.ToString()
 74:                     sb.Length <- 0
 75:                     Some (line, newPos)
 76: 
 77:                 let rec run n =
 78:                     if n >= text.Length then None
 79:                     else 
 80:                         match n with
 81:                         | Chars ('\r', Some '\n') -> getLine (n + 2)
 82:                         | Chars ('\r', _) 
 83:                         | Chars ('\n', _) -> getLine (n + 1)
 84:                         | Chars (c, _) -> 
 85:                             sb.Append(c) |> ignore
 86:                             run(n + 1)
 87:                 match run n with
 88:                 | Some (line, pos) -> return Value (line, doProcess text pos next)
 89:                 | None -> return! doRead next
 90:                 }
 91:                 
 92:             this.AsyncReadSeq(?bufferSize=bufferSize)
 93:                 |> AsyncSeq.map Encoding.UTF8.GetString
 94:                 |> doRead
 95:         
 96:         member this.AsyncWriteSeq(seq : AsyncSeq<byte[]>) = 
 97:             let rec run s = async {
 98:                 let! chunk = s
 99:                 match chunk with
100:                 | Done -> return ()
101:                 | Value(data, next) ->
102:                     do! this.AsyncWrite(data)
103:                     return! run next
104:                 }
105:             run seq       
106: 
107: open System.IO
108: 
109: let printWithPrefix path prefix = async {
110:     use f= File.Open(path, FileMode.Open)
111:     do! f.AsyncReadLines()
112:         |> AsyncSeq.map (sprintf "%s: %s" prefix)
113:         |> AsyncSeq.run (printfn "%s")
114:     }
Multiple items
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>

--------------------

type Async
with
  static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * System.AsyncCallback * obj -> System.IAsyncResult) * (System.IAsyncResult -> 'T) * (System.IAsyncResult -> unit)
  static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> System.Delegate)
  static member AwaitIAsyncResult : iar:System.IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
  static member AwaitTask : task:System.Threading.Tasks.Task<'T> -> Async<'T>
  static member AwaitWaitHandle : waitHandle:System.Threading.WaitHandle * ?millisecondsTimeout:int -> Async<bool>
  static member CancelDefaultToken : unit -> unit
  static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
  static member FromBeginEnd : beginAction:(System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
  static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
  static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
  static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
  static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (System.OperationCanceledException -> unit) -> unit) -> Async<'T>
  static member Ignore : computation:Async<'T> -> Async<unit>
  static member OnCancel : interruption:(unit -> unit) -> Async<System.IDisposable>
  static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
  static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:System.Threading.CancellationToken -> 'T
  static member Sleep : millisecondsDueTime:int -> Async<unit>
  static member Start : computation:Async<unit> * ?cancellationToken:System.Threading.CancellationToken -> unit
  static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:System.Threading.Tasks.TaskCreationOptions * ?cancellationToken:System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
  static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
  static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:System.Threading.Tasks.TaskCreationOptions -> Async<System.Threading.Tasks.Task<'T>>
  static member StartImmediate : computation:Async<unit> * ?cancellationToken:System.Threading.CancellationToken -> unit
  static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(System.OperationCanceledException -> unit) * ?cancellationToken:System.Threading.CancellationToken -> unit
  static member SwitchToContext : syncContext:System.Threading.SynchronizationContext -> Async<unit>
  static member SwitchToNewThread : unit -> Async<unit>
  static member SwitchToThreadPool : unit -> Async<unit>
  static member TryCancelled : computation:Async<'T> * compensation:(System.OperationCanceledException -> unit) -> Async<'T>
  static member CancellationToken : Async<System.Threading.CancellationToken>
  static member DefaultCancellationToken : System.Threading.CancellationToken
end

Full name: Microsoft.FSharp.Control.Async
union case Chunk.Done: Chunk<'T>
union case Chunk.Value: 'T * AsyncSeq<'T> -> Chunk<'T>
type AsyncSeq<'T> = Async<Chunk<'T>>

Full name: Snippet.AsyncSeq<_>
val map : ('a -> 'b) -> AsyncSeq<'a> -> AsyncSeq<'b>

Full name: Snippet.AsyncSeq.map
val f : ('a -> 'b)
Multiple items
val seq : AsyncSeq<'a>

--------------------

type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>

  type: seq<'T>
  inherits: System.Collections.IEnumerable
val doMap : (Async<Chunk<'a>> -> Async<Chunk<'b>>)
val s : Async<Chunk<'a>>
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val chunk : Chunk<'a>
val v : 'a
val next : AsyncSeq<'a>
val run : ('a -> unit) -> AsyncSeq<'a> -> Async<unit>

Full name: Snippet.AsyncSeq.run
val action : ('a -> unit)
val doRun : (Async<Chunk<'a>> -> Async<unit>)
val filter : ('a -> bool) -> AsyncSeq<'a> -> AsyncSeq<'a>

Full name: Snippet.AsyncSeq.filter
val f : ('a -> bool)
val doFilter : (Async<Chunk<'a>> -> Async<Chunk<'a>>)
val value : 'a
val x : Chunk<'a>
type AutoOpenAttribute =
  class
    inherit System.Attribute
    new : unit -> AutoOpenAttribute
    new : path:string -> AutoOpenAttribute
    member Path : string
  end

Full name: Microsoft.FSharp.Core.AutoOpenAttribute

  type: AutoOpenAttribute
  implements: System.Runtime.InteropServices._Attribute
  inherits: System.Attribute
namespace System
namespace System.Text
namespace System.IO
type Stream =
  class
    inherit System.MarshalByRefObject
    member BeginRead : System.Byte [] * int * int * System.AsyncCallback * obj -> System.IAsyncResult
    member BeginWrite : System.Byte [] * int * int * System.AsyncCallback * obj -> System.IAsyncResult
    member CanRead : bool
    member CanSeek : bool
    member CanTimeout : bool
    member CanWrite : bool
    member Close : unit -> unit
    member CopyTo : System.IO.Stream -> unit
    member CopyTo : System.IO.Stream * int -> unit
    member Dispose : unit -> unit
    member EndRead : System.IAsyncResult -> int
    member EndWrite : System.IAsyncResult -> unit
    member Flush : unit -> unit
    member Length : int64
    member Position : int64 with get, set
    member Read : System.Byte [] * int * int -> int
    member ReadByte : unit -> int
    member ReadTimeout : int with get, set
    member Seek : int64 * System.IO.SeekOrigin -> int64
    member SetLength : int64 -> unit
    member Write : System.Byte [] * int * int -> unit
    member WriteByte : System.Byte -> unit
    member WriteTimeout : int with get, set
    static val Null : System.IO.Stream
    static member Synchronized : System.IO.Stream -> System.IO.Stream
  end

Full name: System.IO.Stream

  type: System.IO.Stream
  implements: System.IDisposable
  inherits: System.MarshalByRefObject
val this : System.IO.Stream

  type: System.IO.Stream
  implements: System.IDisposable
  inherits: System.MarshalByRefObject
member System.IO.Stream.AsyncReadSeq : ?bufferSize:int -> AsyncSeq<byte []>

Full name: Snippet.AsyncSeqExtensions.AsyncReadSeq
val bufferSize : int option

  type: int option
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<Option<int>>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
Multiple items
module AsyncSeq

from Snippet

--------------------

type AsyncSeq<'T> = Async<Chunk<'T>>

Full name: Snippet.AsyncSeq<_>
Multiple items
val byte : 'T -> byte (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.byte

--------------------

type byte = System.Byte

Full name: Microsoft.FSharp.Core.byte

  type: byte
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<byte>
  implements: System.IEquatable<byte>
  inherits: System.ValueType
val bufferSize : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val defaultArg : 'T option -> 'T -> 'T

Full name: Microsoft.FSharp.Core.Operators.defaultArg
val temp : byte []

  type: byte []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<byte>
  implements: System.Collections.Generic.ICollection<byte>
  implements: seq<byte>
  implements: System.Collections.IEnumerable
  inherits: System.Array
module Array

from Microsoft.FSharp.Collections
val zeroCreate : int -> 'T []

Full name: Microsoft.FSharp.Collections.Array.zeroCreate
val doRead : (unit -> Async<Chunk<byte []>>)
val count : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
Multiple overloads
member System.IO.Stream.AsyncRead : count:int -> Async<byte []>
member System.IO.Stream.AsyncRead : buffer:byte [] * ?offset:int * ?count:int -> Async<int>
val buf : byte []

  type: byte []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<byte>
  implements: System.Collections.Generic.ICollection<byte>
  implements: seq<byte>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val sub : 'T [] -> int -> int -> 'T []

Full name: Microsoft.FSharp.Collections.Array.sub
member System.IO.Stream.AsyncReadLines : ?bufferSize:int -> Async<Chunk<string>>

Full name: Snippet.AsyncSeqExtensions.AsyncReadLines
val sb : StringBuilder

  type: StringBuilder
  implements: System.Runtime.Serialization.ISerializable
type StringBuilder =
  class
    new : unit -> System.Text.StringBuilder
    new : int -> System.Text.StringBuilder
    new : string -> System.Text.StringBuilder
    new : string * int -> System.Text.StringBuilder
    new : string * int * int * int -> System.Text.StringBuilder
    new : int * int -> System.Text.StringBuilder
    member Append : string -> System.Text.StringBuilder
    member Append : bool -> System.Text.StringBuilder
    member Append : System.SByte -> System.Text.StringBuilder
    member Append : System.Byte -> System.Text.StringBuilder
    member Append : char -> System.Text.StringBuilder
    member Append : int16 -> System.Text.StringBuilder
    member Append : int -> System.Text.StringBuilder
    member Append : int64 -> System.Text.StringBuilder
    member Append : float32 -> System.Text.StringBuilder
    member Append : float -> System.Text.StringBuilder
    member Append : decimal -> System.Text.StringBuilder
    member Append : uint16 -> System.Text.StringBuilder
    member Append : uint32 -> System.Text.StringBuilder
    member Append : uint64 -> System.Text.StringBuilder
    member Append : obj -> System.Text.StringBuilder
    member Append : char [] -> System.Text.StringBuilder
    member Append : char * int -> System.Text.StringBuilder
    member Append : char [] * int * int -> System.Text.StringBuilder
    member Append : string * int * int -> System.Text.StringBuilder
    member AppendFormat : string * obj -> System.Text.StringBuilder
    member AppendFormat : string * obj [] -> System.Text.StringBuilder
    member AppendFormat : string * obj * obj -> System.Text.StringBuilder
    member AppendFormat : System.IFormatProvider * string * obj [] -> System.Text.StringBuilder
    member AppendFormat : string * obj * obj * obj -> System.Text.StringBuilder
    member AppendLine : unit -> System.Text.StringBuilder
    member AppendLine : string -> System.Text.StringBuilder
    member Capacity : int with get, set
    member Chars : int -> char with get, set
    member Clear : unit -> System.Text.StringBuilder
    member CopyTo : int * char [] * int * int -> unit
    member EnsureCapacity : int -> int
    member Equals : System.Text.StringBuilder -> bool
    member Insert : int * string -> System.Text.StringBuilder
    member Insert : int * bool -> System.Text.StringBuilder
    member Insert : int * System.SByte -> System.Text.StringBuilder
    member Insert : int * System.Byte -> System.Text.StringBuilder
    member Insert : int * int16 -> System.Text.StringBuilder
    member Insert : int * char -> System.Text.StringBuilder
    member Insert : int * char [] -> System.Text.StringBuilder
    member Insert : int * int -> System.Text.StringBuilder
    member Insert : int * int64 -> System.Text.StringBuilder
    member Insert : int * float32 -> System.Text.StringBuilder
    member Insert : int * float -> System.Text.StringBuilder
    member Insert : int * decimal -> System.Text.StringBuilder
    member Insert : int * uint16 -> System.Text.StringBuilder
    member Insert : int * uint32 -> System.Text.StringBuilder
    member Insert : int * uint64 -> System.Text.StringBuilder
    member Insert : int * obj -> System.Text.StringBuilder
    member Insert : int * string * int -> System.Text.StringBuilder
    member Insert : int * char [] * int * int -> System.Text.StringBuilder
    member Length : int with get, set
    member MaxCapacity : int
    member Remove : int * int -> System.Text.StringBuilder
    member Replace : string * string -> System.Text.StringBuilder
    member Replace : char * char -> System.Text.StringBuilder
    member Replace : string * string * int * int -> System.Text.StringBuilder
    member Replace : char * char * int * int -> System.Text.StringBuilder
    member ToString : unit -> string
    member ToString : int * int -> string
  end

Full name: System.Text.StringBuilder

  type: StringBuilder
  implements: System.Runtime.Serialization.ISerializable
val getText : (AsyncSeq<byte []> -> AsyncSeq<string>)
type Encoding =
  class
    member BodyName : string
    member Clone : unit -> obj
    member CodePage : int
    member DecoderFallback : System.Text.DecoderFallback with get, set
    member EncoderFallback : System.Text.EncoderFallback with get, set
    member EncodingName : string
    member Equals : obj -> bool
    member GetByteCount : char [] -> int
    member GetByteCount : string -> int
    member GetByteCount : char * int -> int
    member GetByteCount : char [] * int * int -> int
    member GetBytes : char [] -> System.Byte []
    member GetBytes : string -> System.Byte []
    member GetBytes : char [] * int * int -> System.Byte []
    member GetBytes : char * int * System.Byte * int -> int
    member GetBytes : char [] * int * int * System.Byte [] * int -> int
    member GetBytes : string * int * int * System.Byte [] * int -> int
    member GetCharCount : System.Byte [] -> int
    member GetCharCount : System.Byte * int -> int
    member GetCharCount : System.Byte [] * int * int -> int
    member GetChars : System.Byte [] -> char []
    member GetChars : System.Byte [] * int * int -> char []
    member GetChars : System.Byte * int * char * int -> int
    member GetChars : System.Byte [] * int * int * char [] * int -> int
    member GetDecoder : unit -> System.Text.Decoder
    member GetEncoder : unit -> System.Text.Encoder
    member GetHashCode : unit -> int
    member GetMaxByteCount : int -> int
    member GetMaxCharCount : int -> int
    member GetPreamble : unit -> System.Byte []
    member GetString : System.Byte [] -> string
    member GetString : System.Byte [] * int * int -> string
    member HeaderName : string
    member IsAlwaysNormalized : unit -> bool
    member IsAlwaysNormalized : System.Text.NormalizationForm -> bool
    member IsBrowserDisplay : bool
    member IsBrowserSave : bool
    member IsMailNewsDisplay : bool
    member IsMailNewsSave : bool
    member IsReadOnly : bool
    member IsSingleByte : bool
    member WebName : string
    member WindowsCodePage : int
    static member ASCII : System.Text.Encoding
    static member BigEndianUnicode : System.Text.Encoding
    static member Convert : System.Text.Encoding * System.Text.Encoding * System.Byte [] -> System.Byte []
    static member Convert : System.Text.Encoding * System.Text.Encoding * System.Byte [] * int * int -> System.Byte []
    static member Default : System.Text.Encoding
    static member GetEncoding : int -> System.Text.Encoding
    static member GetEncoding : string -> System.Text.Encoding
    static member GetEncoding : int * System.Text.EncoderFallback * System.Text.DecoderFallback -> System.Text.Encoding
    static member GetEncoding : string * System.Text.EncoderFallback * System.Text.DecoderFallback -> System.Text.Encoding
    static member GetEncodings : unit -> System.Text.EncodingInfo []
    static member UTF32 : System.Text.Encoding
    static member UTF7 : System.Text.Encoding
    static member UTF8 : System.Text.Encoding
    static member Unicode : System.Text.Encoding
  end

Full name: System.Text.Encoding

  type: Encoding
  implements: System.ICloneable
property Encoding.UTF8: Encoding
Multiple overloads
Encoding.GetString(bytes: byte []) : string
Encoding.GetString(bytes: byte [], index: int, count: int) : string
val doRead : (AsyncSeq<string> -> Async<Chunk<string>>)
val s : AsyncSeq<string>
Multiple items
val string : 'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------

type string = System.String

Full name: Microsoft.FSharp.Core.string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
val chunk : Chunk<string>
property StringBuilder.Length: int
Multiple overloads
System.Object.ToString() : string
StringBuilder.ToString(startIndex: int, length: int) : string
member AsyncBuilder.Return : value:'T -> Async<'T>
val part : string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
val next : AsyncSeq<string>
val doProcess : (string -> int -> AsyncSeq<string> -> Async<Chunk<string>>)
val text : string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
val n : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val pos : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
property System.String.Length: int
union case Option.Some: 'T -> Option<'T>
union case Option.None: Option<'T>
val getLine : ('a -> (string * 'a) option)
val newPos : 'a
val line : string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
val run : (int -> (string * int) option)
active recognizer Chars: int -> char * char option
val c : char

  type: char
  implements: System.IComparable
  implements: System.IConvertible
  implements: System.IComparable<char>
  implements: System.IEquatable<char>
  inherits: System.ValueType
Multiple overloads
StringBuilder.Append(value: char []) : StringBuilder
StringBuilder.Append(value: obj) : StringBuilder
StringBuilder.Append(value: uint64) : StringBuilder
StringBuilder.Append(value: uint32) : StringBuilder
StringBuilder.Append(value: uint16) : StringBuilder
StringBuilder.Append(value: decimal) : StringBuilder
StringBuilder.Append(value: float) : StringBuilder
StringBuilder.Append(value: float32) : StringBuilder
StringBuilder.Append(value: int64) : StringBuilder
StringBuilder.Append(value: int) : StringBuilder
   (+9 other overloads)
val ignore : 'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
member System.IO.Stream.AsyncReadSeq : ?bufferSize:int -> AsyncSeq<byte []>
member System.IO.Stream.AsyncWriteSeq : seq:AsyncSeq<byte []> -> Async<unit>

Full name: Snippet.AsyncSeqExtensions.AsyncWriteSeq
Multiple items
val seq : AsyncSeq<byte []>

--------------------

type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>

  type: seq<'T>
  inherits: System.Collections.IEnumerable
val run : (Async<Chunk<byte []>> -> Async<unit>)
val s : Async<Chunk<byte []>>
val chunk : Chunk<byte []>
val data : byte []

  type: byte []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<byte>
  implements: System.Collections.Generic.ICollection<byte>
  implements: seq<byte>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val next : AsyncSeq<byte []>
member System.IO.Stream.AsyncWrite : buffer:byte [] * ?offset:int * ?count:int -> Async<unit>
val printWithPrefix : string -> string -> Async<unit>

Full name: Snippet.printWithPrefix
val path : string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
val prefix : string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
val f : FileStream

  type: FileStream
  implements: System.IDisposable
  inherits: Stream
  inherits: System.MarshalByRefObject
type File =
  class
    static member AppendAllLines : string * System.Collections.Generic.IEnumerable<string> -> unit
    static member AppendAllLines : string * System.Collections.Generic.IEnumerable<string> * System.Text.Encoding -> unit
    static member AppendAllText : string * string -> unit
    static member AppendAllText : string * string * System.Text.Encoding -> unit
    static member AppendText : string -> System.IO.StreamWriter
    static member Copy : string * string -> unit
    static member Copy : string * string * bool -> unit
    static member Create : string -> System.IO.FileStream
    static member Create : string * int -> System.IO.FileStream
    static member Create : string * int * System.IO.FileOptions -> System.IO.FileStream
    static member Create : string * int * System.IO.FileOptions * System.Security.AccessControl.FileSecurity -> System.IO.FileStream
    static member CreateText : string -> System.IO.StreamWriter
    static member Decrypt : string -> unit
    static member Delete : string -> unit
    static member Encrypt : string -> unit
    static member Exists : string -> bool
    static member GetAccessControl : string -> System.Security.AccessControl.FileSecurity
    static member GetAccessControl : string * System.Security.AccessControl.AccessControlSections -> System.Security.AccessControl.FileSecurity
    static member GetAttributes : string -> System.IO.FileAttributes
    static member GetCreationTime : string -> System.DateTime
    static member GetCreationTimeUtc : string -> System.DateTime
    static member GetLastAccessTime : string -> System.DateTime
    static member GetLastAccessTimeUtc : string -> System.DateTime
    static member GetLastWriteTime : string -> System.DateTime
    static member GetLastWriteTimeUtc : string -> System.DateTime
    static member Move : string * string -> unit
    static member Open : string * System.IO.FileMode -> System.IO.FileStream
    static member Open : string * System.IO.FileMode * System.IO.FileAccess -> System.IO.FileStream
    static member Open : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare -> System.IO.FileStream
    static member OpenRead : string -> System.IO.FileStream
    static member OpenText : string -> System.IO.StreamReader
    static member OpenWrite : string -> System.IO.FileStream
    static member ReadAllBytes : string -> System.Byte []
    static member ReadAllLines : string -> string []
    static member ReadAllLines : string * System.Text.Encoding -> string []
    static member ReadAllText : string -> string
    static member ReadAllText : string * System.Text.Encoding -> string
    static member ReadLines : string -> System.Collections.Generic.IEnumerable<string>
    static member ReadLines : string * System.Text.Encoding -> System.Collections.Generic.IEnumerable<string>
    static member Replace : string * string * string -> unit
    static member Replace : string * string * string * bool -> unit
    static member SetAccessControl : string * System.Security.AccessControl.FileSecurity -> unit
    static member SetAttributes : string * System.IO.FileAttributes -> unit
    static member SetCreationTime : string * System.DateTime -> unit
    static member SetCreationTimeUtc : string * System.DateTime -> unit
    static member SetLastAccessTime : string * System.DateTime -> unit
    static member SetLastAccessTimeUtc : string * System.DateTime -> unit
    static member SetLastWriteTime : string * System.DateTime -> unit
    static member SetLastWriteTimeUtc : string * System.DateTime -> unit
    static member WriteAllBytes : string * System.Byte [] -> unit
    static member WriteAllLines : string * string [] -> unit
    static member WriteAllLines : string * System.Collections.Generic.IEnumerable<string> -> unit
    static member WriteAllLines : string * string [] * System.Text.Encoding -> unit
    static member WriteAllLines : string * System.Collections.Generic.IEnumerable<string> * System.Text.Encoding -> unit
    static member WriteAllText : string * string -> unit
    static member WriteAllText : string * string * System.Text.Encoding -> unit
  end

Full name: System.IO.File
Multiple overloads
File.Open(path: string, mode: FileMode) : FileStream
File.Open(path: string, mode: FileMode, access: FileAccess) : FileStream
File.Open(path: string, mode: FileMode, access: FileAccess, share: FileShare) : FileStream
type FileMode =
  | CreateNew = 1
  | Create = 2
  | Open = 3
  | OpenOrCreate = 4
  | Truncate = 5
  | Append = 6

Full name: System.IO.FileMode

  type: FileMode
  inherits: System.Enum
  inherits: System.ValueType
field FileMode.Open = 3
member Stream.AsyncReadLines : ?bufferSize:int -> Async<Chunk<string>>
val sprintf : Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val printfn : Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn

More information

Link: http://fssnip.net/1Y
Posted: 3 years ago
Author: Vladimir Matveev
Tags: F#, Async, Async sequences