Mercurial > hg > Papers > 2015 > atton-thesis
view src/delta_instance_monad.hs @ 49:ba7f0b5454ab
Add description for DeltaM definition
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Feb 2015 14:07:07 +0900 |
parents | c4da3e667aad |
children |
line wrap: on
line source
headDelta :: Delta a -> a headDelta (Mono x) = x headDelta (Delta x _) = x tailDelta :: Delta a -> Delta a tailDelta (Mono x) = Mono x tailDelta (Delta _ ds) = ds instance Monad Delta where return x = Mono x (Mono x) >>= f = f x (Delta x d) >>= f = Delta (headDelta (f x)) (d >>= (tailDelta . f))