comparison agda/deltaM.agda @ 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 a271f3ff1922
comparison
equal deleted inserted replaced
100:d8cd880f1d78 101:29c54b0197fb
66 -> (A -> B) -> DeltaM M {functorM} {monadM} A -> DeltaM M {functorM} {monadM} B 66 -> (A -> B) -> DeltaM M {functorM} {monadM} A -> DeltaM M {functorM} {monadM} B
67 deltaM-fmap {l} {A} {B} {M} {functorM} f (deltaM d) = deltaM (fmap delta-is-functor (fmap functorM f) d) 67 deltaM-fmap {l} {A} {B} {M} {functorM} f (deltaM d) = deltaM (fmap delta-is-functor (fmap functorM f) d)
68 68
69 -- monad definitions 69 -- monad definitions
70 open Monad 70 open Monad
71 deltaM-eta : {l : Level} {A B : Set l} {M : {l' : Level} -> Set l' -> Set l'} 71 deltaM-eta : {l : Level} {A : Set l} {M : {l' : Level} -> Set l' -> Set l'}
72 {functorM : {l' : Level} -> Functor {l'} M} 72 {functorM : {l' : Level} -> Functor {l'} M}
73 {monadM : {l' : Level} {A : Set l'} -> Monad {l'} {A} M functorM} 73 {monadM : {l' : Level} {A : Set l'} -> Monad {l'} {A} M functorM}
74 -> A -> (DeltaM M {functorM} {monadM} A) 74 -> A -> (DeltaM M {functorM} {monadM} A)
75 deltaM-eta {_} {A} {_} {_} {_} {monadM} x = deltaM (mono (eta {_} {A} monadM x)) 75 deltaM-eta {_} {A} {_} {_} {monadM} x = deltaM (mono (eta {_} {A} monadM x))
76 76
77 deltaM-mu : {l : Level} {A : Set l} {M : {l' : Level} -> Set l' -> Set l'} 77 deltaM-mu : {l : Level} {A : Set l} {M : {l' : Level} -> Set l' -> Set l'}
78 {functorM : {l' : Level} -> Functor {l'} M} 78 {functorM : {l' : Level} -> Functor {l'} M}
79 {monadM : {l' : Level} {A : Set l'} -> Monad {l'} {A} M functorM} 79 {monadM : {l' : Level} {A : Set l'} -> Monad {l'} {A} M functorM}
80 -> (DeltaM M {functorM} {monadM} (DeltaM M {functorM} {monadM} A)) -> DeltaM M {functorM} {monadM} A 80 -> (DeltaM M {functorM} {monadM} (DeltaM M {functorM} {monadM} A)) -> DeltaM M {functorM} {monadM} A
81 deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (mono x)) = deltaM (mono (bind {l} {A} monadM x headDeltaM)) 81 deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (mono x)) = deltaM (mono (mu {l} {A} monadM (fmap functorM headDeltaM x)))
82 deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (delta x (mono xx))) = appendDeltaM (deltaM (mono (bind {l} {A} monadM x headDeltaM))) 82 deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (delta x (mono xx))) = appendDeltaM (deltaM (mono (bind {l} {A} monadM x headDeltaM)))
83 (deltaM-mu (deltaM (mono xx))) 83 (deltaM-mu (deltaM (mono xx)))
84 deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (delta x (delta xx d))) = appendDeltaM (deltaM (mono (bind {l} {A} monadM x headDeltaM))) 84 deltaM-mu {l} {A} {M} {functorM} {monadM} (deltaM (delta x (delta xx d))) = appendDeltaM (deltaM (mono (bind {l} {A} monadM x headDeltaM)))
85 (deltaM-mu (deltaM d)) 85 (deltaM-mu (deltaM d))
86 -- original deltaM-mu definitions. but it's cannot termination checking. 86 -- original deltaM-mu definitions. but it's cannot termination checking.