3 ms·
Sorry... in Haskell there is performUnsafeIO. Nothing in Haskell is therefore guaranteed to be pure! Hello Downvoter: I know it is silly but the article is tal
by bbcbasic 10y ago
Sorry... in Haskell there is performUnsafeIO. Nothing in Haskell is therefore guaranteed to be pure!
Hello Downvoter: I know it is silly but the article is talking about equally silly JS by overriding valueOf.
- masklinn 10y agoThe question is asked providing the entire implementation of the respective sum functions in terms of primitives. There's no room for unsafePerformIO in the Haskell code (assuming prelude's `(+)` and `foldl`). 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.
- bbcbasic 10y agoOk sure but I was meaning in general. Anyway pass in (repeat 0) and you get a side effect. :-)
- masklinn 10y ago> Ok sure but I was meaning in general. 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.
- tel 10y agoHaskell is well-known not to be pure in supporting non-terminating computation.
- lmm 10y agoSure, that's an issue with Haskell - much better to use Idris.
- yyhhsj0521 10y agoUse Safe Haskell [https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/safe-haskell.html https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_gui...]