Several issues in monad and foldable instances fixed.
Unit tests for memory module.