-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monad Transformer Stack #1354
Comments
This is the recommended way. You can also leverage the type-building functors,
This is a rather common convention in OCaml, especially within the Janestreet-style libraries. The motivation is to enable composability between modules that are generated by functors. Basically, each functor implements some trait and the final module is composed of several includes, e.g.,
Since before some, rather recent, version of OCaml, it wasn't possible to include a module that defines a type into a structure that already has that type (even it is equal) we had to remove types from the traits. It is no longer a problem in modern OCaml, at least in 4.09.0 I can safely compose two modules with intersecting types, but the convention is still there. At least for backward compatibility with the older versions of OCaml. We can probably add a functor |
@addap, are you satisfied with an answer? Maybe you have any suggestions on how we can improve it? Starting from documentation and ending in implementing, |
Hi @ivg, Since the MakeT functor is probably the same everywhere I'm wondering if functors can be parameterized by functors in OCaml?
but I guess some |
Yes, that would work and this is indeed how I would implement it. The only minor caveat is that we have two kinds of monads, unary |
Hi,
I was wondering how to compose multiple monad transformers from your transformer library.
I'm using version 2.3.0 from opam.
The naive approach does not work
because R is missing a definition for type t, so it does not conform to the Monad signature.
I saw in ogre.ml that you can hack around this by defining t in a new module
bap/lib/ogre/ogre.ml
Lines 808 to 813 in 51b4988
But that is not mentioned in the docs as far as I can tell. So is that the recommended way to build a monad transformer stack using this library?
The text was updated successfully, but these errors were encountered: