First step of reducing module boilerplate.

- Extract a GenericInputModule type with methods common to all input
  modules.
- Change all existing input modules to use it.