#r @"../bin/FSharpx.Extras.dll"
open System
open FSharpx.Undo
module Sample =
let rec handleInput<'a> = undoable {
match Console.ReadLine() with
| "undo" ->
let! _ = undo
()
| input ->
match Double.TryParse input with
| true,x -> do! combineWithCurrent (+) x
| _ -> ()
let! currentVal = getCurrent
printfn "The current total is %O" currentVal
return! handleInput }
Sample.handleInput (newHistory 0.) |> ignore
namespace System
val handleInput<'a> : (obj -> obj)
'a
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary>
Console.ReadLine() : string
[<Struct>]
type Double =
member CompareTo: value: float -> int + 1 overload
member Equals: obj: float -> bool + 1 overload
member GetHashCode: unit -> int
member GetTypeCode: unit -> TypeCode
member ToString: unit -> string + 3 overloads
member TryFormat: destination: Span<char> * charsWritten: byref<int> * ?format: ReadOnlySpan<char> * ?provider: IFormatProvider -> bool
static member (<) : left: float * right: float -> bool
static member (<=) : left: float * right: float -> bool
static member (<>) : left: float * right: float -> bool
static member (=) : left: float * right: float -> bool
...
<summary>Represents a double-precision floating-point number.</summary>
Double.TryParse(s: string, result: byref<float>) : bool
Double.TryParse(s: ReadOnlySpan<char>, result: byref<float>) : bool
Double.TryParse(s: string, style: Globalization.NumberStyles, provider: IFormatProvider, result: byref<float>) : bool
Double.TryParse(s: ReadOnlySpan<char>, style: Globalization.NumberStyles, provider: IFormatProvider, result: byref<float>) : bool
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
module Sample
from UndoSample
val ignore: value: 'T -> unit