3 people like it.
Like the snippet!
A Simple Implementation of Lazy Type
A Simple Implementation of Lazy Type.
1:
2:
3:
4:
5:
6:
7:
8:
|
type Lazy<'T> =
| Lazy of 'T ref
static member RefValue(Lazy a) = a
member l.Force() = (Lazy.RefValue l) |> (!)
let lazyValue = Lazy (ref 10)
let res = lazyValue.Force()
|
Multiple items
active recognizer Lazy: Lazy<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.( |Lazy| )
--------------------
type Lazy<'T> = System.Lazy<'T>
Full name: Microsoft.FSharp.Control.Lazy<_>
Multiple items
union case Lazy.Lazy: 'T ref -> Lazy<'T>
--------------------
active recognizer Lazy: Lazy<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.( |Lazy| )
--------------------
type Lazy<'T> =
| Lazy of 'T ref
member Force : unit -> 'T
static member RefValue : Lazy<'a> -> 'a ref
Full name: Script.Lazy<_>
Multiple items
val ref : value:'T -> 'T ref
Full name: Microsoft.FSharp.Core.Operators.ref
--------------------
type 'T ref = Ref<'T>
Full name: Microsoft.FSharp.Core.ref<_>
static member Lazy.RefValue : Lazy<'a> -> 'a ref
Full name: Script.Lazy`1.RefValue
Multiple items
union case Lazy.Lazy: 'T ref -> Lazy<'T>
--------------------
type Lazy<'T> =
| Lazy of 'T ref
member Force : unit -> 'T
static member RefValue : Lazy<'a> -> 'a ref
Full name: Script.Lazy<_>
val a : 'a ref
val l : Lazy<'T>
member Lazy.Force : unit -> 'T
Full name: Script.Lazy`1.Force
static member Lazy.RefValue : Lazy<'a> -> 'a ref
val lazyValue : Lazy<int>
Full name: Script.lazyValue
val res : int
Full name: Script.res
member Lazy.Force : unit -> 'T
More information