Population sampling prototype using state monad