indigo-0.2.2: Convenient imperative eDSL over Lorentz.
Safe HaskellNone



Backend of the statements to create and modify variables



newVar :: KnownValue x => Expr x -> IndigoState inp (x & inp) (Var x) Source #

Create a new variable with passed expression as an initial value.

setVar :: forall a inp. Var a -> Expr a -> IndigoState inp inp () Source #

Set the variable to a new value.

If a variable is a cell on the stack, we just compile passed expression and replace variable cell on stack. If a variable is decomposed, we decompose passed expression and call setVar recursively from its fields.

setField :: forall dt fname ftype inp. (IsObject dt, IsObject ftype, HasField dt fname ftype) => Var dt -> Label fname -> Expr ftype -> IndigoState inp inp () Source #

Set the field (direct or indirect) of a complex object.

updateVar :: (IsObject x, KnownValue y) => ([y, x] :-> '[x]) -> Var x -> Expr y -> IndigoState inp inp () Source #

Call binary operator with constant argument to update variable in-place.