In the meantime I have discovered a flaw in my original
diagonalisation in that it looped in finite cases.
This can easily be mended:
DiagWK1:
diag :: [[a]] - [a]
diag = f id where
f :: ([[a]] - [[a]]) - [[a]] - [a]
f a [] = split id (a []) []
f a (l:ls) = split id (a [l]) ls
split
DiagMPJ 0:00.16 0:02.32 0:37.55
DiagMPJ1 0:00.12 0:01.50 0:23.83
DiagWK1 0:00.12 0:01.34 0:19.02
DiagWK2 0:00.12 0:01.35 0:19.09
DiagWK3 0:00.12 0:01.34 0:18.82
The only thing that surprises me is
that the compiler does not do the optimization from DiagWK2
to