-- | Assign a value to a mutable variable. The variable must have been originally created with
--   'mutable' or 'mutable_', or there will be an error when generating the install file.
(@=) :: Exp t -> Exp t -> Action ()
(@=) v w = do v <- rval v; Value w <- w; emit $ Assign v w


-- | Introduce a variable scope. Scopes are automatically introduced by operations
--   such as 'iff', 'loop', 'while' etc. Inside a scope you may define new variables
--   whose names may clash with variables outside the scope, but the local versions will be used.
--
--   If you have any non-evaluated expressions, before introducing any potentially clashing
--   variables in the scope you should 'share' them or use 'constant_' on them. For example:
--
-- @
-- operate x = do
--     x <- 'constant_' x
--     'scope' $ do
--         'constant' \"TEST\" 0
-- @
--
--   It is important to turn @x@ into a 'constant_' before defining a new constant @$TEST@, since
--   if @x@ refers to @$TEST@ after the new definition, it will pick up the wrong variable.
(@=) :: Exp t -> Exp t -> Action ()
(@=) v w = do v <- rval v; Value w <- w; emit $ Assign v w


-- | Introduce a variable scope. Scopes are automatically introduced by operations
--   such as 'iff', 'loop', 'while' etc. Inside a scope you may define new variables
--   whose names may clash with variables outside the scope, but the local versions will be used.
--
--   If you have any non-evaluated expressions, before introducing any potentially clashing
--   variables in the scope you should 'share' them or use 'constant_' on them. For example:
--
-- @
-- operate x = do
--     x <- 'constant_' x
--     'scope' $ do
--         'constant' \"TEST\" 0
-- @
--
--   It is important to turn @x@ into a 'constant_' before defining a new constant @$TEST@, since
--   if @x@ refers to @$TEST@ after the new definition, it will pick up the wrong variable.
(@=) v w = do v <- rval v; Value w <- w; emit $ Assign v w


-- | Introduce a variable scope. Scopes are automatically introduced by operations
--   such as 'iff', 'loop', 'while' etc. Inside a scope you may define new variables
--   whose names may clash with variables outside the scope, but the local versions will be used.
--
--   If you have any non-evaluated expressions, before introducing any potentially clashing
--   variables in the scope you should 'share' them or use 'constant_' on them. For example:
--
-- @
-- operate x = do
--     x <- 'constant_' x
--     'scope' $ do
--         'constant' \"TEST\" 0
-- @
--
--   It is important to turn @x@ into a 'constant_' before defining a new constant @$TEST@, since
--   if @x@ refers to @$TEST@ after the new definition, it will pick up the wrong variable.