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

ArgMin and ArgMax can't work #49

Closed
MarkZander opened this issue Jul 28, 2015 · 1 comment
Closed

ArgMin and ArgMax can't work #49

MarkZander opened this issue Jul 28, 2015 · 1 comment

Comments

@MarkZander
Copy link

I attempted to use ArgMin but got the following error:

No instance for (Bounded (Arg Number LocalTime))

And sure enough there is no Bounded instance for Arg which Min requires.

Nothing that another orphan instance won't work around.

@ekmett
Copy link
Owner

ekmett commented Jul 28, 2015

It works just fine.

If you want a Monoid you'll need a Bounded instance, but if you just want a Semigroup you don't.

I cannot give you a Bounded instance for Arg. Its ordering isn't structural. Period. That path cannot work. You hit a dead end.

You are looking for Option (ArgMax a b). This adds in a unit.

No orphan is required, just careful knowledge of what instance you are actually looking for.

@ekmett ekmett closed this as completed Jul 28, 2015
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

No branches or pull requests

2 participants