Hacker News new | past | comments | ask | show | jobs | submit login

  function foo() {
    print('effects');
  }
The above is not a function. It's a procedure.



And what about

    bar = error "effects"


It's a partial function that always returns _|_. Haskell is not a total language (and whether a total language can be practical is yet to be seen).


Sure, but what it returns is not an issue. The issue is that it does have an effect.


Whether it has an effect is not an issue. The issue is that it is referentially transparent.

Sure, we could have a discussion about whether partiality is an effect. Someone, somewhere is having that discussion. If the Haskell committee had had this discussion in 1987, chances are we wouldn't have Haskell at all.


This is the exact same objection people have been raising for 20 years. Yes, lifted types and partiality are probably bad. No, this isn’t an argument against distinguishing between functions and other objects. If anything, it just goes to show that Haskell should have been even more extremist about effect management.


> No, this isn’t an argument against distinguishing between functions and other objects

It was not supposed to be one. Rather, it was there to show that just like other languages Haskell functions can have effects (even if discouraged).




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

Search: