-
Notifications
You must be signed in to change notification settings - Fork 24
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
Make Divisible unconquerable #49
Comments
This sounds like: "??? is to Divisible as Apply is to Applicative". It feels like it should be in class Contravariant f => Divide f where
divide :: (a -> (b, c)) -> f b -> f c -> f a
class Divide f => Divisible f where
conquer :: f a
class Divide f => Decide f where
choose :: (a -> Either b c) -> f b -> f c -> f a
class (Divisible f, Decide f) => Decideable f where
lose :: (a -> Void) -> f a I'm pattern-matching off the semigroupoids diagram, and skipping over It would be great if someone who knew the maths could check over this hierarchy and make sure that none of the splits result in lawless typeclasses. |
@ekmett, any thoughts? |
I'm actually exploring something similar in the I went the other way with the So my thoughts right now are that there is a tension between making a more broadly applicable class and making a class that people really can understand how to use and that matches up with what is available on the other side of the mirrored class hierarchy. |
I think my biggest objection to |
It strikes me as quite strange and somewhat unfortunate that
conquer
is a method ofDivisible
. I really think it should be in a subclass. The fundamental idea ofDivisible
is it's for problems that can be handled in arbitrary pieces. The notion of a default handler looks like extra power on top of that. Here's a simple example:To get
conquer
, this needs aMonoid
constraint.So I think
Divisible
should dropconquer
, and there should be a separate class for that.The text was updated successfully, but these errors were encountered: