Skip to content
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

Add Re-exports of relevant types #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Profpatsch
Copy link

This makes the modules easier to use, since you don’t have to add
e.g. monad-control-identity to your cabal file just to refer to the
class in a type signature.

This makes the modules easier to use, since you don’t have to add
e.g. monad-control-identity to your cabal file just to refer to the
class in a type signature.
@jumper149
Copy link
Owner

jumper149 commented Sep 20, 2021

wai-websocket also does not do any re-exports. I think the two modules here make sense.

When it comes to MonadBaseControlIdentity, I also wouldn't re-export it. Mainly because these are two different usages.

  1. Adding the MonadBaseControlIdentity instance for your ReaderT-Stack
  2. Actually lifting wai Applications

Edit:
The only sensible way here, would be to drop the monad-control-identity-dependency and replace it with unliftio. But then again, you might actually call this package wai-unliftio or something like that.

Generally I personally really like the idea of completely removing MonadIO and MonadUnliftIO and instead using MonadBase and MonadBaseControl. This is basically the same argument that made Applicative a superclass of Monad.

@Profpatsch
Copy link
Author

I reevaluated this PR, I think the only thing to reexport are typeclasses and stuff you absolutely need all the time to use the library.

e.g. I always hate that https://hackage.haskell.org/package/http-types-0.12.3/docs/Network-HTTP-Types.html#v:status400 and such are in a different package, so in order to write a Wai response you need to always add http-types to your cabal file after a few minutes.

But hls will now show e.g. MonadBaseControlIdentity to come from Websockets.Trans as the first result, so it should only be reexported from the main Trans module.

The reexports of MonadBase(ControlIdentity) are mainly so that you can
use the class signatures in your modules without having to also
specify transitive dependencies.

So re-exporting them once from this library is enough.

We keep the reexport of websocket types in the `Websocket.Trans`
module for the same reason.

For the `Wai` types we can expect that somebody depending on
`wai-control` will also depend on `wai` already, so that’s not as much
of a problem.
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.

None yet

2 participants