Move monadic memoization to LOTOS.Util.
codegen: Process each free variable only once.