nikita-volkov / typeclasses

Explicit typeclasses for Elm
https://package.elm-lang.org/packages/nikita-volkov/typeclasses/latest/
MIT License
54 stars 3 forks source link

Bounded Typeclass #5

Closed lukejoshua closed 4 years ago

lukejoshua commented 4 years ago

Add a Bounded typeclass to represent types with a minimum and maximum value.

The following instances have been included:

Bounded pairs and triples can be derived from the member types, provided they are themselves bounded.

nikita-volkov commented 4 years ago

Thanks. That would be a good addition.

There is a problem though. As you might have noticed, the library establishes a naming convention, where typeclass names are nouns standing for the functionality they provide. So we need to find some proper noun name.

lukejoshua commented 4 years ago

Perhaps "Interval" would be more suitable?

nikita-volkov commented 4 years ago

Perhaps "Interval" would be more suitable?

Also Bounds and Limitation. Limitation has more of the functionality ring to it, but Bounds reminds of Bounded. Hmm..

lukejoshua commented 4 years ago

Of those two I think Bounds would work best. What about Limits or Limit instead?

nikita-volkov commented 4 years ago

Let's go with Bounds

lukejoshua commented 4 years ago

Since the other typeclasses expose their respective record constructors, should Bounds continue doing so instead of making it an opaque type?

nikita-volkov commented 4 years ago

Since the other typeclasses expose their respective record constructors, should Bounds continue doing so instead of making it an opaque type?

Sure!

nikita-volkov commented 4 years ago

Since now bounds is just an alias to Bounds, there's no point in having it. Let's remove it altogether. It'll only confuse people.

Apart from that, I'm ready to merge.

Also it'll be nice to add a mapping function.

nikita-volkov commented 4 years ago

Thanks! Great work