Modified the HashTable version to perform an early exit by explicitly running the loop rather than a monadic fold.