Equivalent to Haskell's Enum typeclass?
erlandsona opened this issue · 4 comments
I recently pulled in bs-deriving to generate some enum helpers for a polyvariant type I was using to model a multi select.
Which was fine till I upgraded bs-platform to 7.2.2 which the ppx doesn't work for which got me wondering why Bastet doesn't have an implementation for the Enum typeclass?
It would be good to get Enum
and BoundedEnum
in, it looks like it would be pretty straightforward to implement -- just add succ
, pred
and the Verify
laws which are straightfoward:
https://pursuit.purescript.org/packages/purescript-enums/4.0.1/docs/Data.Enum#t:Enum
I probably won't have the bandwidth to work on this any time soon though. PR are very welcome though!
Turns out it's in Relude so I think we can just wait for them to upstream their Interfaces work apparently? @mlms13 correct me if I'm misquoting.
If you're open to a PR, we have ENUM
, BOUNDED_ENUM
, LOWER_BOUNDED
, and UPPER_BOUNDED
in Relude, and I've been meaning to send them your way. I'll put together a PR in just a bit.
Nice! yeah sure thing