Skip to content

Make Divisible unconquerable #49

Description

@treeowl

It strikes me as quite strange and somewhat unfortunate that conquer is a method of Divisible. I really think it should be in a subclass. The fundamental idea of Divisible 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:

newtype Flipparr a b = Fliparr {unfliparr :: b -> a}

instance Semigroup a => Divisible (Fliparr) a where
  divide f (Fliparr g) (Fliparr h) = Fliparr $ \a ->
    case f a of
      (b, c) -> g b <> h c

To get conquer, this needs a Monoid constraint.

So I think Divisible should drop conquer, and there should be a separate class for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions