Added a few combinators to make the programs easier.

I've added `retrieve`, which given a reference and a function, applies
the function to the associated value and returns it in a monadic
context. Besides I've added `holds`, which uses the *retrieve*
implementation but forces the result type to be a bool.
ZipWithIndex has been improved up.

After applying some new combinators and others improvements the
resulting encodings are short and readable.