!import "base" !Local !import "list" !Local !import "io" !Local -- Environment effects: ask and local. -- ask reads the current environment value. -- local f action runs action with the env transformed by f. -- -- The CLI starts with an empty (Leaf) environment. This demo uses -- local to inject a real string so that ask returns something readable. main = io <| (bind local (_ : "sandbox") (bind ask (env : bind (putStrLn (append "working in env: " env)) (_ : pure "inside-done")))) (outside : bind (putStrLn (append "local returned: " outside)) (_ : pure t))