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

fromInfinite errors #40

Closed
pgujjula opened this issue Apr 11, 2024 · 3 comments · Fixed by #41
Closed

fromInfinite errors #40

pgujjula opened this issue Apr 11, 2024 · 3 comments · Fixed by #41

Comments

@pgujjula
Copy link
Contributor

Running the following example:

naturals :: UChimera Int
naturals = fromInfinite (0...)

main :: IO ()
main = print (index naturals 0)

results in the error

Data.Primitive.Array.fromListN: list length greater than specified size
CallStack (from HasCallStack):
  error, called at ./Data/Primitive/Array.hs:373:19 in primitive-0.8.0.0-EBSr4O8W5US1YYODUpLUQc:Data.Primitive.Array

Can you confirm if you can also reproduce this @Bodigrim? I can prepare a PR for this one as well. Thanks!

@Bodigrim
Copy link
Owner

Yep, I can reproduce this one as well.

@pgujjula
Copy link
Contributor Author

Opened PR #41 with a fix

Bodigrim pushed a commit that referenced this issue Apr 12, 2024
In the implementation of fromInfinite, we pass an infinite list to
Data.Primitive.Array.fromListN (bits + 1), but fromListN expects a list
a list of length (bits + 1), which results in a runtime error.

To fix this, we add a check in go to break recursion and to ensure that
the list that is passed into fromListN has length (bits + 1).
@Bodigrim Bodigrim linked a pull request Apr 12, 2024 that will close this issue
@Bodigrim
Copy link
Owner

Fixed in #41.

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

Successfully merging a pull request may close this issue.

2 participants