switch to a monad interface.

This lets us kill the unsafeMonadIO ID generation.