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 Enum type class #2342

Closed
kubukoz opened this issue Jul 27, 2018 · 4 comments
Closed

Add Enum type class #2342

kubukoz opened this issue Jul 27, 2018 · 4 comments

Comments

@kubukoz
Copy link
Member

kubukoz commented Jul 27, 2018

No description provided.

@Michaelt293
Copy link

Michaelt293 commented Aug 26, 2018

See #1536

@johnynek
Copy link
Contributor

I have taken a stab at this before with mixed success:

https://github.com/twitter/algebird/blob/develop/algebird-core/src/main/scala/com/twitter/algebird/Successible.scala

Some challenges:

  1. what if you are countable, but not bounded? e.g. BigInteger
  2. what if you are upper bounded but not lower bounded?

If you have something unbounded, you want def next(a: A): A, but if you are bounded, you want def next(a: A): Option[A].

As for a law, I think it is something like: a < next(a) and there is nothing in between: forAll { (a, b) => if (a < b) (b == next(a) || next(a) < b) else true

@sideeffffect
Copy link
Contributor

this ticket can be closed
cc @LukaJCB @travisbrown

@LukaJCB
Copy link
Member

LukaJCB commented Jul 17, 2020

good call, thanks @sideeffffect!

@LukaJCB LukaJCB closed this as completed Jul 17, 2020
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

5 participants