-- GeNeRaTeD fOr: ../../CBS/Funcons/Computations/Control flow/Normal/Iterating/Indefinite/while.aterm {-# LANGUAGE OverloadedStrings #-} module Funcons.Core.Computations.ControlFlow.Normal.Iterating.Indefinite.While where import Funcons.EDSL entities = [] types = typeEnvFromList [] funcons = libFromList [("while",NonStrictFuncon stepWhile)] -- | -- /while(B,C)/ first evaluates /B/ . -- Depending on whether the computed value is /true/ or /false/ , -- it then executes /C/ and repeats, or terminates normally. while_ fargs = FApp "while" (FTuple fargs) stepWhile fargs = evalRules [rewrite1] [] where rewrite1 = do let env = emptyEnv env <- fsMatch fargs [PMetaVar "B",PMetaVar "C"] env rewriteTermTo (TApp "if-then-else" (TTuple [TVar "B",TApp "sequential" (TTuple [TVar "C",TApp "while" (TTuple [TVar "B",TVar "C"])]),TTuple []])) env