-
Notifications
You must be signed in to change notification settings - Fork 24
Move toEnum&fromEnum into the Enum class, provide range functions. #6
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
Conversation
…ntations for succ,pred,toEnum,fromEnum
@jdegoes can you review this one please? |
Assuming this compiles to something that works (always have to be careful with ScopedTypeVariables workarounds), and that it gets a middle version increment (0.x.0), 👍 . Nice work @NightRa! |
Thanks @jdegoes! Feel free to merge :) |
One thing that concerns me is the local definition of |
Let me at first update the dependencies for the array ST changes |
Done |
@garyb Ready for merging |
Move toEnum&fromEnum into the Enum class, provide range functions.
* first commit * Fix instances for record fields * Break modules up * Deriving Show (#5) * Initial work on deriving Show * Add test for Show * Remove import * Travis etc. * Data.Generic.Rep.Bounded (#6) * Data.Generic.Rep.Bounded Generic implementations of Prelude.Bounded class's top and bottom. * GenericBounded - don't support product types * GenericBounded - only support NoArguments * Update for PureScript 0.11 * Add Generic instance for Maybe (#9) * Add missing Bounded instances for Argument * Add GenericEnum and GenericBoundedEnum * Add enum tests, convert existing "tests" into assertions * Product instances in Bounded and Enum * Added GenericShowFields instances for NoConstructors and NoArguments (#20) * Added Eq and Show instances to NoArguments and NoConstructors * Added GenericShowFields * Removed Show, Eq * Cleanup * Removed NoConstructors Show instance * Remove Rec and Field & update package & bower symbols * Bump deps for compiler/0.12 * Remove symbols and fix operator fixity issue * Update dependencies, license * Added HeytingAlgebra, Semiring, Ring * Fix type annotation precedence in tests * Replace monomorphic proxies by Type.Proxy.Proxy (#44) * Move Enum file to Data.Enum.Generic * Update module name to match file name for Enum * Update module path for Bounded Generic * Move test file to Data.Enum folder and rename to Generic.purs * Remove code unrelated to Enum in test file * Update Generic X module names to Data.X.Generic * Rename `main` function in test file to testGenericEnum * Update module name in test file to match file name * Remove all files in repo that are unrelated to Enum Generic * Include Enum's Generic tests in repo's tests * Remove unused logShow Co-authored-by: Phil Freeman <paf31@cantab.net> Co-authored-by: Matthew Leon <ml@matthewleon.com> Co-authored-by: Gary Burgess <gary.burgess@gmail.com> Co-authored-by: Liam Goodacre <goodacre.liam@gmail.com> Co-authored-by: Jorge Acereda <jacereda@gmail.com> Co-authored-by: Kristoffer Josefsson <kejace@gmail.com> Co-authored-by: Denis Stoyanov <stoyanov.gr@gmail.com> Co-authored-by: Harry Garrood <harry@garrood.me> Co-authored-by: Cyril <sobierajewicz.cyril@gmail.com>
This PR moves toEnum and fromEnum into the Enum class, providing default implementations for succ, pred, toEnum and fromEnum.
The move is nessesary for providing O(1) toEnum and fromEnum implementations.
Migration guide:
-- Add toEnum & fromEnum to all Enum classes, with a fallback to default implementations.
-- Beware of ScopedTypeVariables and passing typeclass functions to the default implementations.
-- See the implementation for workarounds.
Also, this PR adds the range functions for enums.