Introduce the ReaderM and WriterM monads.

ReaderM can only read arrays and references, while WriterM is also
allowed to create new ones and change them.
Remove unneeded type annotations.

They were only required when we had the
  type Ref m a :: *
alias in the ReadRef class. It has now been changed to
  type Ref m :: * -> *
which workes better.
The same thing for the arrays required
the UndecidableInstances language pragma, why?