Hacker News new | ask | show | jobs
by grenoire 3564 days ago
Is it then the variable (or the variable accessor) that is impure, or the function that is impure?
1 comments

The variable accessor is a function of type Variable -> Field, which the function sum is calling. Because of that, the function sum is impure, as it's calling an impure function. I would argue that the object is just a wrapper around a function, and in essence making the sum function implicitly higher order, as you're passing it a function to retrieve a value, rather than an actual value.