4 ms·
The cost is significant: introducing one more level of indirection (for tagging) is not cheap. However, Maybe can be implemented without tagging, see[0] for ex
by klntsky 7y ago
The cost is significant: introducing one more level of indirection (for tagging) is not cheap.
However, Maybe can be implemented without tagging, see[0] for example.
[0] https://hackage.haskell.org/package/unpacked-maybe https://hackage.haskell.org/package/unpacked-maybe
- mratsim 7y agoDo you have a benchmark that measures this cost? I'm pretty sure the cost of checking this in a static language where the tag enums range is known at compile-time is: - 100x cheaper than cache-miss on a memory access - and 10000x cheaper than IO which is often where those errors/results/maybe/exceptions issues arise. I.e. irrelevant in most cases.