Mutables in Gjallarhorn
One core type in Gjallarhorn is a Mutable.
A Mutable extends the concept of a signal by allowing the current value to be changed.
The simplest Mutable can be created via Mutable.create:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: |
|
As it's name suggests, Mutable.create takes an initial value and wraps it into a Mutable, which is represented via the IMutatable<'a> interface.
IMutatable<'a> inherits ISignal<'a>, but extends the .Value property to be both gettable and settable, which we can use to fetch or mutate the current value at any point.
As all Mutables are also signals, the Signal module functionality still works:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: |
|
Now, let's move on to Validation in Gjallarhorn.
val m : obj
Full name: Mutables.m
Full name: Mutables.m
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn