(* generic tags *) module type Tag = sig type 'a tag end module Tagging (T : Tag) = struct module type Tagged = sig val tag : 'a -> bool -> 'a T.tag val get_tag : 'a T.tag -> bool val get_a : 'a T.tag -> 'a val process : 'a T.tag -> ('a -> 'b) -> ('a -> 'b) -> 'b end end (**** implementations of Tag *****) module BoolTag = struct type 'a tag = 'a * bool end module OptTag = struct type 'a tag = 'a option end (* open StateCPSMonad presently unused *) module TaggingA (TAG : Tag)(T : Abstract.T) = struct module type Tagged = sig type 'a tag = 'a TAG.tag val tag : 'a T.abstract -> bool T.abstract -> 'a tag T.abstract val get_tag : 'a tag T.abstract -> bool T.abstract val process : 'a tag T.abstract -> ((bool T.abstract -> ('b -> ('x -> 'y -> 'y) -> unit T.abstract)) option) -> ('a T.abstract -> ('b -> ('c -> 'd -> 'd) -> 'e T.abstract)) -> (unit -> ('b -> ('f -> 'g -> 'g) -> 'e T.abstract)) -> ('b -> ('b -> 'e T.abstract -> 'h) -> 'h) end end