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

please add instance Listable Numeric.Natural #22

Open
jwaldmann opened this issue Apr 13, 2023 · 1 comment
Open

please add instance Listable Numeric.Natural #22

jwaldmann opened this issue Apr 13, 2023 · 1 comment
Assignees

Comments

@jwaldmann
Copy link

it seems that Numeric.Natural https://hackage.haskell.org/package/base-4.18.0.0/docs/Numeric-Natural.html is the standard non-negative integer type now.

I would welcome a Listable instance. Simply this?

instance T.Listable Natural where
  tiers = T.mapT (fromIntegral @T.Natural) T.tiers

Later, Test.LeanCheck.Util.Types.Natural could be dropped.

@rudymatela
Copy link
Owner

The Listable Numeric.Natural instance is available in the leancheck-instances (leancheck-instances on GitHub).

For now, with both leancheck and leancheck-instances installed you can get the instance for Natural (and more) with:

import Test.LeanCheck
import Test.LeanCheck.Instances

My intention not including these instances in the LeanCheck package was to keep the dependency footprint low.

... though I now see that Numeric.Natural has been available in base since GHC 7.10... So perhaps it is worth migrating it to the main LeanCheck package. 🤔 Though I will need some CPP tricks to keep near-backwards compatibility with Haskell98, GHC 7.8 and Hugs. It will take a little while to flesh-out the migration as I need to coordinate a new release of leancheck-instances as well.

(I'll keep this issue open while I investigate and until I complete the migration.)

Thanks for the suggestion!

@rudymatela rudymatela self-assigned this May 10, 2023
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