Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My Haskell is rusty enough that I don’t know the proper syntax for it, but you can make a program that calls foo and then throws away / never uses the IO computation. Because Haskell is lazy, “Hello” will never be printed.




You can do this

    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?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: