Mercurial > hg > Papers > 2015 > atton-thesis
view paper/src/delta_instance_monad.hs @ 92:0354d3693324 default tip
Added tag paper_final for changeset 6a12eb22be8c
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 01 Mar 2015 13:08:51 +0900 |
parents | 1181b4facaf9 |
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))