I am learning Haskell. If I understand correctly, a simple function in Haskell is always referentially transparent. I thought it means its output depends only on the arguments passed to it.
But a function f can call another function g, defined in the outer scope. So in that sense, f‘s return value depends on the definition of g. And the function g is not passed to f as a parameter – at least not explicitly. Doesn’t this break referential transparency?
Referential transparency means that
is indistinguishable from
and
It means you can inline
gintofwithout it altering the meaning off.If it was going to alter the meaning of
f, you would have to altergsomehow. How?