Mercurial > hg > Members > atton > delta_monad
changeset 101:29c54b0197fb
Fix bind definition on DeltaM. use mu.
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 25 Jan 2015 12:15:19 +0900 |
parents | d8cd880f1d78 |
children | 9c62373bd474 |
files | agda/deltaM.agda delta.hs |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/agda/deltaM.agda Fri Jan 23 17:44:53 2015 +0900 +++ b/agda/deltaM.agda Sun Jan 25 12:15:19 2015 +0900 @@ -68,17 +68,17 @@ -- monad definitions open Monad -deltaM-eta : {l : Level} {A B : Set l} {M : {l' : Level} -> Set l' -> Set l'} +deltaM-eta : {l : Level} {A : Set l} {M : {l' : Level} -> Set l' -> Set l'} {functorM : {l' : Level} -> Functor {l'} M} {monadM : {l' : Level} {A : Set l'} -> Monad {l'} {A} M functorM} -> A -> (DeltaM M {functorM} {monadM} A) -deltaM-eta {_} {A} {_} {_} {_} {monadM} x = deltaM (mono (eta {_} {A} monadM x)) +deltaM-eta {_} {A} {_} {_} {monadM} x = deltaM (mono (eta {_} {A} monadM x)) deltaM-mu : {l : Level} {A : Set l} {M : {l' : Level} -> Set l' -> Set l'} {functorM : {l' : Level} -> Functor {l'} M} {monadM : {l' : Level} {A : Set l'} -> Monad {l'} {A} M functorM} -> (DeltaM M {functorM} {monadM} (DeltaM M {functorM} {monadM} A)) -> DeltaM M {functorM} {monadM} A -deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (mono x)) = deltaM (mono (bind {l} {A} monadM x headDeltaM)) +deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (mono x)) = deltaM (mono (mu {l} {A} monadM (fmap functorM headDeltaM x))) deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (delta x (mono xx))) = appendDeltaM (deltaM (mono (bind {l} {A} monadM x headDeltaM))) (deltaM-mu (deltaM (mono xx))) deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (delta x (delta xx d))) = appendDeltaM (deltaM (mono (bind {l} {A} monadM x headDeltaM)))
--- a/delta.hs Fri Jan 23 17:44:53 2015 +0900 +++ b/delta.hs Sun Jan 25 12:15:19 2015 +0900 @@ -125,8 +125,8 @@ mu' :: (Functor m, Monad m) => DeltaM m (DeltaM m a) -> DeltaM m a -mu' (DeltaM (Mono x)) = DeltaM $ Mono $ x >>= headDeltaM -mu' (DeltaM (Delta x d)) = appendDeltaM (DeltaM $ Mono $ x >>= headDeltaM) +mu' (DeltaM (Mono x)) = DeltaM $ Mono $ (>>= id) $ fmap headDeltaM x +mu' (DeltaM (Delta x d)) = appendDeltaM (mu' $ DeltaM $ Mono x) (mu' $ fmap tailDeltaM $ DeltaM d ) instance (Functor m, Monad m) => Monad (DeltaM m) where