indigo-0.1.0.0: 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 exc. (IfConstraint a b, exc :~> Bool) => exc -> 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 exa. (IfConstraint a b, KnownValue x, exa :~> Maybe x) => exa -> (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 exa. (IfConstraint a b, KnownValue x, KnownValue y, exa :~> Either y x) => exa -> (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 exa. (IfConstraint a b, KnownValue x, exa :~> List x) => exa -> (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 #