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

Add Stdlib.Data.Result and find in Stdlib.Data.List #106

Merged
merged 9 commits into from
Jul 10, 2024
Merged

Conversation

paulcadman
Copy link
Collaborator

@paulcadman paulcadman commented Jul 9, 2024

This PR adds implementations of the following, with corresponding tests:

  • An Result type with associated functions to the standard library.
  • A find function to Stdlib.Data.List

Requirements for both arose when writing Anoma applications.

NB:

Adding the {-# specialize: [1] #-} pragma to find causes the compiler to go into an infinite loop when compiling a find call with predicate const false, e.g

find {Nat} (const false) [1;2;3]

So I've omitted that for now and I'll raise a separate bug, I suspect I was using the specialize pragma incorrectly.

@paulcadman paulcadman self-assigned this Jul 9, 2024
@paulcadman
Copy link
Collaborator Author

The formatting check is failing because of:

@paulcadman paulcadman changed the title Add Stdlib.Data.Either and find in Stdlib.Data.List Add Stdlib.Data.Result and find in Stdlib.Data.List Jul 10, 2024
@paulcadman paulcadman marked this pull request as ready for review July 10, 2024 11:00
@lukaszcz
Copy link
Contributor

As for the specialize pragma, I think it's a bug. The use seems correct, and even if not, it should never loop. Please raise an issue in the juvix repository.

@paulcadman
Copy link
Collaborator Author

As for the specialize pragma, I think it's a bug. The use seems correct, and even if not, it should never loop. Please raise an issue in the juvix repository.

Thanks for the encouragement, I'll raise an issue.

@paulcadman paulcadman merged commit 216cb60 into main Jul 10, 2024
2 checks passed
paulcadman added a commit to anoma/juvix that referenced this pull request Jul 10, 2024
This update adds the stdlib Result type and a `find` function to `List`.

See anoma/juvix-stdlib#106
paulcadman added a commit to anoma/juvix that referenced this pull request Jul 10, 2024
This update adds the stdlib Result type and a `find` function to `List`.

See anoma/juvix-stdlib#106
paulcadman added a commit to anoma/juvix that referenced this pull request Jul 10, 2024
This update adds the stdlib Result type and a `find` function to `List`.

See anoma/juvix-stdlib#106
paulcadman added a commit to anoma/juvix that referenced this pull request Jul 10, 2024
This update adds the stdlib Result type and a `find` function to `List`.

See anoma/juvix-stdlib#106
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 this pull request may close these issues.

2 participants