3 ms·
I'm a big fan of hybrid functionals. I think being able to fall back to somewhat imperative code makes sense on occasion. Some things are better expressed in ei
by bpicolo 10y ago
I'm a big fan of hybrid functionals. I think being able to fall back to somewhat imperative code makes sense on occasion. Some things are better expressed in either paradigm, and that's OK.
- pka 10y agoYou can do that perfectly fine even in a pure language like Haskell.
- omaranto 10y agoOr maybe Haskell is also a hybrid? I know about the type theoretic accounting tricks used to stay pure, but when I really need unboxed mutable arrays and several tight loops, I just use the ST monad and write code that is psychologically completely imperative. And it compiles to pretty fast executables too, especially using the LLVM backend.
- pka 10y agoYeah, that's what I meant. You can't tell from the type signature alone if a pure function uses ST though, so I'd say that counts as pure :)