val permute : 'a m -> 'a m m
val select : 'a m -> ('a * 'a m) m
*)
+ val expose : ('x,'a) m -> ('x,'a list) Wrapped.m
end
end = struct
module Base = struct
let permute : 'a m -> 'a m m
let select : 'a m -> ('a * 'a m) m
*)
+ let expose u = u
end
end
val ask : ('x,env) m
val asks : (env -> 'a) -> ('x,'a) m
val local : (env -> env) -> ('x,'a) m -> ('x,'a) m
+ val expose : ('x,'a) m -> env -> ('x,'a) Wrapped.m
end
end = struct
type env = Env.env
let asks selector = ask >>= (fun e ->
try unit (selector e)
with Not_found -> fun e -> Wrapped.zero ())
+ let expose u = u
end
end
val gets : (store -> 'a) -> ('x,'a) m
val put : store -> ('x,unit) m
val puts : (store -> store) -> ('x,unit) m
+ (* val passthru : ('x,'a) m -> (('x,'a * store) Wrapped.result * store -> 'b) -> ('x,'b) m *)
+ val expose : ('x,'a) m -> store -> ('x,'a * store) Wrapped.m
end
end = struct
type store = Store.store
with Not_found -> Wrapped.zero ()
let put s = fun _ -> Wrapped.unit ((), s)
let puts modifier = fun s -> Wrapped.unit ((), modifier s)
+ (* let passthru u f = fun s -> Wrapped.unit (f (Wrapped.run (u s), s), s) *)
+ let expose u = u
end
end
(* note that second argument is an 'a tree?, not the more abstract 'a m *)
(* type is ('a -> 'b W) -> 'a tree? -> 'b tree? W == 'b treeT(W) *)
val distribute : ('a -> ('x,'b) Wrapped.m) -> 'a tree option -> ('x,'b) m
+ val expose : ('x,'a) m -> ('x,'a tree option) Wrapped.m
end
end = struct
type 'a tree = Leaf of 'a | Node of ('a tree * 'a tree)
end
include BaseT
let distribute f t = mapT (fun a -> elevate (f a)) t zero plus
+ let expose u = u
end
end;;