Fixed Martingale.hs so that we maintain referential transparency throughout.