Skip to content

Support Control.Monad.Trans.{Writer,RWS}.CPS from transformers 0.5.6 - #67

Merged
RyanGlScott merged 1 commit into
haskell:masterfrom
lexi-lambda:support-writer-cps
Aug 29, 2019
Merged

RyanGlScott merged 1 commit into
haskell:masterfrom
lexi-lambda:support-writer-cps

Conversation

@lexi-lambda

Copy link
Copy Markdown
Contributor

transformers-0.5.6.0 adds new Control.Monad.Trans.Writer.CPS and Control.Monad.Trans.RWS.CPS monad transformers, so this PR adds support for them in mtl.

I’ve taken the liberty of bumping the version to 2.3, since this seems like a significant enough change to do so, and picking what the next release’s version number will be was necessary for the @since annotations in the docs. Let me know if you’d like me to do something else, and I’ll change it.

@fishtreesugar

Copy link
Copy Markdown
Contributor

It could fix #38

@chessai

chessai commented Jul 24, 2019

Copy link
Copy Markdown
Member

At a glance, this looks great! But could you remove the version bump? That's something that's typically done prior to a release, and not based on any one contribution alone.

@lexi-lambda

Copy link
Copy Markdown
Contributor Author

@chessai Sure, I’ve removed the version bump. I’ve left the Haddock annotations alone, so they still say @since 2.3, since I’m not sure what else to do with those. Let me know if there’s something better.

@lexi-lambda

Copy link
Copy Markdown
Contributor Author

@chessai Pinging you about this. Is there anything in the way of getting this merged?

@chessai

chessai commented Aug 28, 2019

Copy link
Copy Markdown
Member

Thanks for the ping. I see one problem, currently: The lower bound of the transformers dependency has been bumped from 4 to 5.6. It's possible that this could disrupt some users. IMO we should keep the old bounds and wrap all this code in CPP.

@chessai

chessai commented Aug 28, 2019

Copy link
Copy Markdown
Member

Also keeping the since pragmas as you currently have them is fine, IMO.

@lexi-lambda

Copy link
Copy Markdown
Contributor Author

I’m happy to put the CPP in if you think the version bump on transformers is too much, but I admit I don’t personally see why it would be worth it. transformers has effectively zero dependencies. In what scenario could someone upgrade to a newer version of mtl but couldn’t upgrade to a newer version of transformers?

@chessai

chessai commented Aug 28, 2019 •

Copy link
Copy Markdown
Member

Personally i don't see a huge issue. Perhaps @hvr or @RyanGlScott could weigh in here?

@lexi-lambda

Copy link
Copy Markdown
Contributor Author

In the absolute worst case scenario, if people complain, we could always release a version with the CPP and relaxed bounds after the fact… it isn’t like releasing a version with the tighter bounds locks us into them or anything.

@RyanGlScott

Copy link
Copy Markdown
Member

I think I'm in favor of CPP as well. transformers is a GHC boot library, which means that any build plan that depends on GHC-the-library must use the version of transformers bundled with GHC itself. Combine this with the fact that transformers-0.5.6.0 was only bundled with GHC starting with 8.6 and you can get yourself into situations where the only way to construct valid build plans is to upgrade GHC itself, which is often much more painful than installing a newer version of a library.

This is not to say that we should continue to support all versions of transformers indefinitely—I think it would make sense to drop this CPP at some point in the future. As things stand currently, however, you can end up having build plans that only support GHC 8.6 or 8.8, which isn't as wide of a support window as I'd like for such a widely used library.

@chessai

chessai commented Aug 28, 2019

Copy link
Copy Markdown
Member

I second ryan's comment, the CPP is needed, at least for now.

@lexi-lambda

Copy link
Copy Markdown
Contributor Author

transformers is a GHC boot library, which means that any build plan that depends on GHC-the-library must use the version of transformers bundled with GHC itself.

Maybe I’m misunderstanding some distinction, but isn’t mtl also a boot library, as of GHC 8.4? The list of modules at https://downloads.haskell.org/~ghc/latest/docs/html/libraries/index.html seems to include modules from mtl… but on the other hand, https://hackage.haskell.org/package/ghc-8.6.5/dependencies lists a dependency on transformers, as you describe, but not on mtl. So I guess there’s a difference between them I’m not aware of.

In any case, what you said is compelling, so I’m happy to add the CPP. I do have one question, though: is there any way to conditionally include an entire module in exposed-modules based on the version of a library? As far as I can tell, there isn’t, so should I just make Control.Monad.Writer.CPS an empty module on unsupported transformers versions? That seems a bit confusing, but if it’s the only way, I’ll do it.

@RyanGlScott

Copy link
Copy Markdown
Member

Maybe I’m misunderstanding some distinction, but isn’t mtl also a boot library, as of GHC 8.4?

Good point, I was somewhat vague in my use of the phrase "boot library" earlier. Both mtl and transformers are bundled with GHC itself, since various libraries (e.g., Cabal) depend on them. GHC-the-library depends on transformers, but not mtl, so in this sense transformers is "more wired in" than mtl is.

As far as I can tell, there isn’t, so should I just make Control.Monad.Writer.CPS an empty module on unsupported transformers versions?

Yes, that should be fine. Do make sure to leave a mention of this somewhere in the surrounding Haddocks.

@lexi-lambda

Copy link
Copy Markdown
Contributor Author

Good point, I was somewhat vague in my use of the phrase "boot library" earlier. Both mtl and transformers are bundled with GHC itself, since various libraries (e.g., Cabal) depend on them. GHC-the-library depends on transformers, but not mtl, so in this sense transformers is "more wired in" than mtl is.

Got it, thanks for the explanation!

Yes, that should be fine. Do make sure to leave a mention of this somewhere in the surrounding Haddocks.

Alright, I’ve pushed an updated set of changes that does that.

@RyanGlScott
RyanGlScott merged commit ee511c5 into haskell:master Aug 29, 2019
@RyanGlScott

Copy link
Copy Markdown
Member

Thanks!

@RyanGlScott RyanGlScott mentioned this pull request Aug 29, 2019
@lexi-lambda
lexi-lambda deleted the support-writer-cps branch August 29, 2019 12:24
@jberryman jberryman mentioned this pull request Sep 28, 2021
6 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants