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

Indigo.Backend.Conditional

Description

Conditional statements of Indigo language.

Synopsis

Documentation

if_ :: forall inp xs ys a b. IfConstraint a b => Expr Bool -> IndigoState inp xs a -> IndigoState inp ys b -> IndigoState inp (RetOutStack a ++ inp) (RetVars a) Source #

If statement. All variables created inside its branches will be released after the execution leaves the scope in which they were created.

ifSome :: forall inp xs ys x a b. (IfConstraint a b, KnownValue x) => Expr (Maybe x) -> (Var x -> IndigoState (x & inp) xs a) -> IndigoState inp ys b -> IndigoState inp (RetOutStack a ++ inp) (RetVars a) Source #

If which works like case for Maybe.

ifRight :: forall inp xs ys x y a b. (IfConstraint a b, KnownValue x, KnownValue y) => Expr (Either y x) -> (Var x -> IndigoState (x & inp) xs a) -> (Var y -> IndigoState (y & inp) ys b) -> IndigoState inp (RetOutStack a ++ inp) (RetVars a) Source #

If which works like case for Either.

ifCons :: forall inp xs ys x a b. (IfConstraint a b, KnownValue x) => Expr (List x) -> (Var x -> Var (List x) -> IndigoState (x & (List x & inp)) xs a) -> IndigoState inp ys b -> IndigoState inp (RetOutStack a ++ inp) (RetVars a) Source #

type IfConstraint a b = (ScopeCodeGen a, ScopeCodeGen b, CompareBranchesResults (RetExprs a) (RetExprs b), RetVars a ~ RetVars b, RetOutStack a ~ RetOutStack b) Source #