3 ms·
This is similar to what Haskell has with trace[1]. It pretends to be a pure function (so it doesn't need the IO monad), but prints to stderr. [1] https://hacka
by maleldil 1y ago
This is similar to what Haskell has with trace[1]. It pretends to be a pure function (so it doesn't need the IO monad), but prints to stderr.
[1] https://hackage.haskell.org/package/base-4.21.0.0/docs/Debug-Trace.html#v:trace https://hackage.haskell.org/package/base-4.21.0.0/docs/Debug...
- JoelMcCracken 1y agoAnd, just like tfa alludes, it is awkward because of laziness; in non trivial scenarios it can be quite surprising how your trace isn’t tracing. This is bc of non strict eval in Haskell, but still the core is that the lang is designed to not eval stuff when it’s not necessary.