Mode lifecycle #124

Implementation
--------------

Mode lifecycle is managed by `ModeManager`. For now, it only consists of a cleanup
handler. The engine stores his declared modes in an `Array Int (IO ModeManager)`.
We decides to store a `ModeManager` within an `IO` action in order to let a mode the
ability to initialize its context before returning a `ModeManager` value.