I don't think this quite works as written. The second rule needs to be "when (Offset =/=Int 0) andBool (Offset2 <=Int Offset)" and the third rule needs to match the front of the list now, not the end.