Skip to content

Add TypeClass.Property.Generator implementation for streams#49

Open
florius0 wants to merge 2 commits intowitchcrafters:mainfrom
florius0:feature/stream-property-generator
Open

Add TypeClass.Property.Generator implementation for streams#49
florius0 wants to merge 2 commits intowitchcrafters:mainfrom
florius0:feature/stream-property-generator

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.

1 participant