type_class icon indicating copy to clipboard operation
type_class copied to clipboard

Add TypeClass.Property.Generator implementation for streams

Open florius0 opened this issue 3 years ago • 0 comments

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
  • [x] Does this change require a release to be made? Is so please create and deploy the release

florius0 avatar Jun 15 '22 23:06 florius0