When itself is a function :: Boolean -> m Unit -> m Unit
You can see the source of when here
As I understand, when <condition> do <something> would act like:
if <condition>
then do <something>
else pure unit
So in TryPurescript you can indent it like this
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Data.Foldable (fold)
import TryPureScript (DOM, h1, h2, p, text, list, indent, link, render, code)
main :: Eff (dom :: DOM) Unit
main = do
if true
then do
render $ h1 (text "True is true")
render $ h2 (text "True is still true")
else pure unit
render $ h2 (text "Outside of the inner do")
This would be equivalent to
main :: Eff (dom :: DOM) Unit
main = do
when true
do
render $ h1 (text "True is true")
render $ h2 (text "True is still true")
render $ h2 (text "Outside of the inner do")