Since the data/monad module's do notation operates on structures, how can I define monad types that are functions, e.g. like parsers?
I'm used to OCaml, where my monad would have had roughly the following signature:
module type Parser = sig
type state = string * int
type 'a t = state -> (('a * state), string) Result.t
val return: 'a -> 'a t
val bind: 'a t -> ('a -> 'b t) -> 'b t
end
I'm sorry to post an example in OCaml, my racket abilities are not great for now.
Is this kind of monad compatible with data/monad, or should I look at another solution?