by masklinn · 10y ago · 0 comments
There could be if the Haskell version was typed on `Num a`, but it's typed on `Int`, which is a standard type with a known pure Num instance.
Anyway pass in (repeat 0) and you get a side effect. :-)
So was I, the article denotes that JS functions can be impure because values carry a "purity stigma" (the value itself can embed impure operations in its manipulation or evaluation).
> Anyway pass in (repeat 0) and you get a side effect. :-)
That's a good point, laziness also carries a "purity stigma". You could actually sneak in unsafePerformIO with an unfold or a lazy list construction.