Commits

Tobias Dammers committed e453bd1

Ternary operator passes for Run

  • Participants
  • Parent commits c339c48

Comments (0)

Files changed (1)

hpaco-lib/Text/HPaco/Writers/Run.hs

                 return . AList $ zip keys' values'
 runExpression (EscapeExpression EscapeHTML e) = (String . htmlEncode . flatten) `liftM` runExpression e
 runExpression (EscapeExpression EscapeURL e) = (String . urlEncode . flatten) `liftM` runExpression e
+runExpression (TernaryExpression cond left right) = do
+    condVal <- runExpression cond
+    let expr =
+            if toBool condVal
+                then left
+                else right
+    runExpression expr
 runExpression (BinaryExpression op left right) = do
     lhs <- runExpression left
     rhs <- runExpression right