Avoid unsafeCoerce# in TopHandler

instead use `... >> fail "..."` to turn IO () into IO a.