-- | An expression orientated version of 'iff', returns the first component if
--   the first argument is 'true' or the second if it is 'false'.
--
-- @
-- x '%==' 12 '?' (x, x '+' 5)
-- @
(?) :: Exp Bool -> (Exp t, Exp t) -> Exp t
(?) test (true, false) = do
    v <- var
    let v2 = return $ Value $ val v
    iff test (v2 @= true) (v2 @= false)
    v2

-- | Test a boolean expression, reunning the first action if it is 'true' and the second if it is 'false'.
--   The appropriate branch action will be run within a 'scope'. See '?' for an expression orientated version.
--
-- @
-- 'iff' (x '%==' 12) ('alert' \"is 12\") ('alert' \"is not 12\")
-- @
(?) :: Exp Bool -> (Exp t, Exp t) -> Exp t
(?) test (true, false) = do
    v <- var
    let v2 = return $ Value $ val v
    iff test (v2 @= true) (v2 @= false)
    v2

-- | Test a boolean expression, reunning the first action if it is 'true' and the second if it is 'false'.
--   The appropriate branch action will be run within a 'scope'. See '?' for an expression orientated version.
--
-- @
-- 'iff' (x '%==' 12) ('alert' \"is 12\") ('alert' \"is not 12\")
-- @
(?) test (true, false) = do
    v <- var
    let v2 = return $ Value $ val v
    iff test (v2 @= true) (v2 @= false)
    v2

-- | Test a boolean expression, reunning the first action if it is 'true' and the second if it is 'false'.
--   The appropriate branch action will be run within a 'scope'. See '?' for an expression orientated version.
--
-- @
-- 'iff' (x '%==' 12) ('alert' \"is 12\") ('alert' \"is not 12\")
-- @