Commits

Tobias Dammers  committed 3f930b6

Fixed ForStatement in JsonLisp writer

  • Participants
  • Parent commits e7d411e

Comments (0)

Files changed (1)

File hpaco-lib/Text/HPaco/Writers/JsonLisp.hs

             --     otherwise -> wrapList $ write "flatten " >> writeWithHead "print" [expr]
         NullStatement -> return ()
         IfStatement expr true false -> writeList [ write $ StringLiteral "if", write expr, write true, write false ]
-        LetStatement identifier expr stmt -> writeList [ write $ StringLiteral "let", write $ StringLiteral identifier, write expr, write stmt ]
-        ForStatement iter identifier expr stmt -> writeList [ write $ StringLiteral "let", write $ StringLiteral identifier, write expr, write stmt ]
+        LetStatement identifier expr stmt ->
+            writeList
+                [ write $ StringLiteral "let"
+                , write $ StringLiteral identifier
+                , write expr
+                , write stmt
+                ]
+        ForStatement iter identifier expr stmt ->
+            writeList
+                [ write $ StringLiteral "for"
+                , maybe (write "null") (write . StringLiteral) iter
+                , write $ StringLiteral identifier
+                , write expr
+                , write stmt
+                ]
         SwitchStatement masterExpr branches -> writeWithHead "switch" (map writeSwitchBranch branches)
         CallStatement identifier ->
             writeWithHead "calldef" [StringLiteral identifier]