Idris2Doc : Data.Linear.Ref1

Data.Linear.Ref1

(source)

Reexports

import public Data.Linear.Token

Definitions

data Ref : Type -> Type -> Type
  A linear mutable reference

Totality: total
Visibility: export
Constructor: 
R1 : Mut a -> Ref s a
0 IORef : Type -> Type
  Alias for `Ref RIO`

Totality: total
Visibility: public export
ref1 : a -> F1 s (Ref s a)
  Creates a new mutable reference tagged with `tag` and holding
initial value `v`.

Totality: total
Visibility: export
newref : Lift1 s f => a -> f (Ref s a)
  

Totality: total
Visibility: export
=DEPRECATED=
newIORef : HasIO io => a -> io (IORef a)
  Creates a mutable reference in `IO` land.

Deprecated: Use `newref` instead

Totality: total
Visibility: export
read1 : Ref s a -> F1 s a
  Reads the current value at a mutable reference tagged with `tag`.

Totality: total
Visibility: export
readref : Lift1 s f => Ref s a -> f a
  Convenience alias for `runIO $ read1 r` for reading a reference in
`IO`.

Totality: total
Visibility: export
write1 : Ref s a -> a -> F1' s
  Updates the mutable reference tagged with `tag`.

Totality: total
Visibility: export
writeref : Lift1 s f => Ref s a -> a -> f ()
  Convenience alias for `runIO $ write1 r v` for writing to a reference in
`IO`.

Totality: total
Visibility: export
caswrite1 : Ref s a -> a -> a -> F1 s Bool
  Atomically writes `val` to the mutable reference if its current
value is equal to `pre`.

This is supported and has been tested on the Chez and Racket backends.
It trivially works on the JavaScript backends, which are single-threaded
anyway.

Totality: total
Visibility: export
casswap1 : Ref s a -> a -> F1' s
  Atomic overwrite of a mutable reference using a CAS-loop
internally

This is supported and has been tested on the Chez and Racket backends.
It trivially works on the JavaScript backends, which are single-threaded
anyway.

Totality: total
Visibility: export
casupdate1 : Ref s a -> (a -> (a, b)) -> F1 s b
  Atomic modification of a mutable reference using a CAS-loop
internally

This is supported and has been tested on the Chez and Racket backends.
It trivially works on the JavaScript backends, which are single-threaded
anyway.

Totality: total
Visibility: export
update : Lift1 s f => Ref s a -> (a -> (a, b)) -> f b
  Atomically updates and reads a mutable reference in `IO`.

This uses `casupdate1` internally.

Totality: total
Visibility: export
casmod1 : Ref s a -> (a -> a) -> F1' s
  Atomic modification of a mutable reference using a CAS-loop
internally

This is supported and has been tested on the Chez and Racket backends.
It trivially works on the JavaScript backends, which are single-threaded
anyway.

Totality: total
Visibility: export
mod1 : Ref s a -> (a -> a) -> F1' s
  Modifies the value stored in mutable reference tagged with `tag`.

Totality: total
Visibility: export
mod : Lift1 s f => Ref s a -> (a -> a) -> f ()
  Atomically modifies a mutable reference in `IO`.

This uses `casmod1` internally.

Totality: total
Visibility: export
Fixity Declaration: infixl operator, level 9
modAndRead1 : Ref s a -> (a -> a) -> F1 s a
  Modifies the value stored in mutable reference tagged with `tag`
and returns the updated value.

Totality: total
Visibility: export
readAndMod1 : Ref s a -> (a -> a) -> F1 s a
  Modifies the value stored in mutable reference tagged with `tag`
and returns the previous value.

Totality: total
Visibility: export
whenRef1 : Ref s Bool -> Lazy (F1' s) -> F1' s
  Runs the given stateful computation only when given boolean flag
is currently at `True`

Totality: total
Visibility: export
0 WithRef1 : Type -> Type -> Type
  Alias for a function taking a linear mutable refernce as
an auto-implicit argument.

Totality: total
Visibility: public export
withRef1 : a -> WithRef1 a b -> b
  Runs a function requiring a linear mutable reference.

Totality: total
Visibility: export
record Lzy : Type -> Type
  A delayed computation with memoization:

The delayed computation will be run only once. After that, the result
will be stored in and retrieved from a mutable reference.

Totality: total
Visibility: public export
Constructor: 
L : Mut (ST a) -> Lzy a

Projection: 
.mut : Lzy a -> Mut (ST a)

Hints:
Applicative Lzy
Functor Lzy
Monad Lzy
.mut : Lzy a -> Mut (ST a)
Totality: total
Visibility: public export
mut : Lzy a -> Mut (ST a)
Totality: total
Visibility: public export
lazy : Lazy a -> Lzy a
  Wraps a delayed computation into a value of type `Lzy`.

Totality: total
Visibility: export
val : Lzy a -> a
  Forces a delayed computation, extracting its value.

Totality: total
Visibility: export
fix : (Lzy a -> a) -> a
  This is unsafe and non-total and highly experimental.

I'll try to eventually implement a safe version of this.

Totality: total
Visibility: export