by erooke · 12mo ago · 0 comments
My understanding is requiring 1 essentially forces you to think of every Monad as being free.
main :: IO ()
main = do
foo
foo
foo :: IO ()
foo = putStrLn "Hello"
and the second in Python: def main():
foo()
foo()
def foo():
print("Hello")
For the Python one I'd say "I/O is done inside `foo` before returning". Would you? If not, why not? And if so, what purpose does it serve to not say the same for the Haskell? main = do
let x = foo
putStrLn "foo was never executed"
but you can also do this def main():
x = foo
print("foo was never executed")
What's the difference?