5 ms·
I don't see how that's a "loophole". Your code has to tie into main somehow, but that's true of other languages too. Or you can call it from the repl. But it ce
by tikhonj 11y ago
I don't see how that's a "loophole". Your code has to tie into main somehow, but that's true of other languages too. Or you can call it from the repl. But it certainly doesn't make sense to talk about executing statements without bringing in the compiler or interpreter, in any language.
You can take a list of IO actions ("statements") and use the sequence function to get a single statement out.
sequence :: Monad m => [m a] -> m [a]
Then you can execute the result by having it in the flow of your program, or pass it around just like any other statement.
The list of statements can be put together however you like.