Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Backend conditional statements of Indigo
Synopsis
- if_ :: forall inp a b. IfConstraint a b => Expr Bool -> SomeIndigoState inp -> a -> SomeIndigoState inp -> b -> RetVars a -> IndigoState inp (RetOutStack a ++ inp)
- ifSome :: forall inp x a b. (IfConstraint a b, KnownValue x) => Expr (Maybe x) -> Var x -> SomeIndigoState (x ': inp) -> a -> SomeIndigoState inp -> b -> RetVars a -> IndigoState inp (RetOutStack a ++ inp)
- ifRight :: forall inp r l a b. (IfConstraint a b, KnownValue r, KnownValue l) => Expr (Either l r) -> Var r -> SomeIndigoState (r ': inp) -> a -> Var l -> SomeIndigoState (l ': inp) -> b -> RetVars a -> IndigoState inp (RetOutStack a ++ inp)
- ifCons :: forall inp x a b. (IfConstraint a b, KnownValue x) => Expr (List x) -> Var x -> Var (List x) -> SomeIndigoState (x ': (List x ': inp)) -> a -> SomeIndigoState inp -> b -> RetVars a -> IndigoState inp (RetOutStack a ++ inp)
- type IfConstraint a b = (ScopeCodeGen a, ScopeCodeGen b, CompareBranchesResults (RetExprs a) (RetExprs b), RetVars a ~ RetVars b, RetOutStack a ~ RetOutStack b)
Documentation
:: forall inp a b. IfConstraint a b | |
=> Expr Bool | Expression for the control flow |
-> SomeIndigoState inp | Code block for the positive branch |
-> a | Return value(s) of the positive branch |
-> SomeIndigoState inp | Code block for the negative branch |
-> b | Return value(s) of the negative branch |
-> RetVars a | Variable(s) that will be assigned to the resulting value(s) |
-> IndigoState inp (RetOutStack a ++ inp) |
If statement. All variables created inside its branches will be released after the execution leaves the scope in which they were created.
:: forall inp x a b. (IfConstraint a b, KnownValue x) | |
=> Expr (Maybe x) | Expression for the control flow |
-> Var x | Variable for the |
-> SomeIndigoState (x ': inp) | Code block for the |
-> a | Return value(s) of the |
-> SomeIndigoState inp | Code block for the |
-> b | Return value(s) of the |
-> RetVars a | Variable(s) that will be assigned to the resulting value(s) |
-> IndigoState inp (RetOutStack a ++ inp) |
If-statement that works like case for Maybe.
:: forall inp r l a b. (IfConstraint a b, KnownValue r, KnownValue l) | |
=> Expr (Either l r) | Expression for the control flow |
-> Var r | Variable for the |
-> SomeIndigoState (r ': inp) | Code block for the |
-> a | Return value(s) of the |
-> Var l | Variable for the |
-> SomeIndigoState (l ': inp) | Code block for the |
-> b | Return value(s) of the |
-> RetVars a | Variable(s) that will be assigned to the resulting value(s) |
-> IndigoState inp (RetOutStack a ++ inp) |
If which works like case for Either.
:: forall inp x a b. (IfConstraint a b, KnownValue x) | |
=> Expr (List x) | Expression for the control flow |
-> Var x | Variable for the "head" value (available to the next code block) |
-> Var (List x) | Variable for the "tail" value (available to the next code block) |
-> SomeIndigoState (x ': (List x ': inp)) | Code block for the non-empty list branch |
-> a | Return value(s) of the non-empty list branch |
-> SomeIndigoState inp | Code block for the empty list branch |
-> b | Return value(s) of the empty list branch |
-> RetVars a | Variable(s) that will be assigned to the resulting value(s) |
-> IndigoState inp (RetOutStack a ++ inp) |
If which works like uncons for lists.
type IfConstraint a b = (ScopeCodeGen a, ScopeCodeGen b, CompareBranchesResults (RetExprs a) (RetExprs b), RetVars a ~ RetVars b, RetOutStack a ~ RetOutStack b) Source #