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 TypeClass.Property.Generator implementation for streams #49

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

florius0
Copy link

Summary

This PR adds implementation of stream property generator

The motivation is to allow an implementation of TypeClasses for Witchcraft and other libs

Test plan (required)

Run the following snippet in iex

iex(1)> TypeClass.Property.Generator.generate(%Stream{})
#Stream<[
  enum: #Function<61.58486609/2 in Stream.unfold/2>,
  funs: [#Function<34.58486609/1 in Stream.drop/2>,
   #Function<55.58486609/1 in Stream.take_after_guards/2>]
]>
iex(2)> TypeClass.Property.Generator.generate(%Stream{}) |> Enum.to_list
[-0.7295208655332303]
iex(3)> TypeClass.Property.Generator.generate(%Stream{}) |> Enum.to_list
["GT", 765]
iex(4)> TypeClass.Property.Generator.generate(%Stream{}) |> Enum.to_list

The first line shows that Stream generator indeed returns a Stream, the following line demonstrate the randomness

After Merge

  • Does this change invalidate any docs or tutorials? If so ensure the changes needed are either made or recorded
  • Does this change require a release to be made? Is so please create and deploy the release

Vadim Tsvetkov added 2 commits June 16, 2022 02:07
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.

None yet

1 participant