myProgram : '{IO, Exception} ()
myProgram = '(printLine "Hello World")
myProgramWithArgs : '{IO, Exception} ()
myProgramWithArgs = 'let
printLine ("Hello " ++ Optional.getOrElse "World" (List.head !getArgs) ++ "!")
.> run myProgram
.> run myProgramWithArgs Rebecca
Therun
command is used to evaluate terms that require the IO ability within ucm. A program that performs IO cannot be evaluated in a watch expression but can be executed withrun
.
Run takes a delayed computation and performs!myProgram
,wheremyProgram
is searched for in the most recent typechecked file, or in the codebase. The function provided to theruncommand must have a final return type of unit,()
,and may perform the IO andException
abilities.
Any arguments following therun
command will be passed as program arguments.