-
Notifications
You must be signed in to change notification settings - Fork 65
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
Adding a proper ListT to transformers and this package #85
Comments
It should be called |
I would be happy to add this, but it raises an interesting problem.
With regard to the first of these, I actually don't know what kind of laws it could have; with regard to the second, this is basically Furthermore, FWIW, my take is that the second interpretation is the more correct one. While I do think @emilypi - thoughts? |
|
|
It might be good to consider prior art:
|
For what it's worth,
|
If you want to ping Ross on the |
The issue is that there is no |
Hmm, you're right that |
I'd be surprised if that can be done in a way such that it gives you the instance you expect. At some point, you need to "concatenate" the lists, and I don't see how that would work out.
How so? |
Maybe this? This is just a guess and I haven't really analyzed it properly.
|
I don't think |
I don't think so. |
So I believe it works. The problem is that |
On the plus side, |
I agree as well now :) thanks for your explanation!
Yes, since I think a newtype wrapper would be good, because you could then write: newtype ChoiceT t m a = ChoiceT { unChoiceT :: StreamT (t m) a }
instance (Monad m => MonadPlus (t m)) => MonadTrans (ChoiceT t)
instance MonadPlus (t m) => Monad (ChoiceT t m) That way you get all the instances you want without having to specialise to Maybe we can turn this conversation closer to Also, is adding a further dependency to |
Note that you do have |
Yes, and the motivation behind the |
OK, that makes sense. I have no idea whether this |
Yes I think it is. It's like a "return code" for the stream execution. Most streaming libraries have something like this, because drum roll it makes the stream also a monad in |
So in that case, one possibility is this:
|
This |
Yes, although I really like your more general |
I think we should add a type equivalent to the following to transformers (and mtl):
This is a monad transformer, while it's well-known that the existing ListT is not.
And perhaps we should add the relevant MonadChoice class here (subject to design discussion)
Ideally this would happen in cooperation between the two libraries, hence why I'm opening it here. We would at least need all the instances to lift MonadX through ChoiceT
Bikeshedding name suggestions: ChoiceT, StreamT, NonDetT, ...
The text was updated successfully, but these errors were encountered: