3 ms·
they don't involve mutation on the language semantics level. The mutation happens through the runtime (via calls to the C FFI). In reality they're implemented
by rtpg 12y ago
they don't involve mutation on the language semantics level. The mutation happens through the runtime (via calls to the C FFI).
In reality they're implemented in a mutation-heavy way for performaance reasons, but on the language level absolutely no mutation happens ( it's the whole World -> (Result, World) analogy)
- carterschonwald 12y agoThey're not done via cffi . its all compiler supported primops that get optimized and lowered to target native assembly.
- theseoafs 12y agoThe whole point about where the mutation happens and how the language remains pure in spite of it is not awfully relevant. The point is that Haskell does support real, bona-fide mutation in its standard library (see for example its support for stateful IO arrays). So obviously mutation is useful, regardless of whether you're doing that mutation behind a pure interface.