☰
handles
handles
Functions
create a new instance with new value refered to by a given handle
get the value refered to by a given handle
return the last handle that was created by 'new'
create a new instance with one additional handle
the new handle can be accessed by 'result.last'
the new handle can be accessed by 'result.last'
create a new instance with the value refered to by a given handle read and
updated.
updated.
cells.
handles is a state monad. It provides features to create several
handles that refer to modifiable value and features to 'get', 'put' or
'update' this value.
an example of using handles is shown below, handle (singular) is an
alias to initialize a new handle with the given initial value. handle0 T
is the type that allows passing around handles.
the example also shows the difference between handles and the mutate effect:
while both provide a way to store and update a mutable value, a handle can be
passed around between features. meanwhile, mutables are not a type that can be
given to other features, only values can. handles essentially provide an
abstraction of pointers, implemented natively in Fuzion.