This is due to a perf bug in GHC's GC implementation that causes it to
traverse entire arrays when a single element has been changed. Hence the
Haskell is over an order of magnitude slower than most languages and even
slower than Python (!).

The purely functional trees that you also used are apparently the idiomatic
Haskell workaround but, of course, they are extremely inefficient and still
over an order of magnitude slower than any decent hash table.