Immutable state

Separate out application state and associated logic to ui/state.js using
*immutable-js* to represent the entire application state in a single
immutable value.

The interface takes a callback that is called each time state changes,
and returns a dispatch function used to dispatch actions which result in
applying transforms to state.