Support of Set #356
Copy link
Copy link
Open
Labels
Description
Activity
We'll need to generalize some internals for that. Maybe we could do it in 1.3
Reacted by Peter Solnica, Mark Glossop, Vadim Lazebny and Jan DudulskiAre there any ideas about this feat ? I guess it can be very useful
@Alexxfrolov this is as simple as:
[4] pry(main)> Types::Set = Types.Constructor(Set, Set.method(:new)) => #<Dry::Types[Constructor<Nominal<Set> fn=Set.new>]> [5] pry(main)> Types::Set[["a", "a", "b", "c"]] => #<Set: {"a", "b", "c"}>
I'm not 100% sure we should have it in the lib though but we'll think about it.
Reacted by Alex Frolov and Derek BenderReacted by Jan DudulskiThat lets you enforce the type is
Set, but doesn't allow type composition likeArray.of.Reacted by Mike Roach
Is there a plan to support Set?
I am trying to use dry-types in place of Virtus in Grape. Currently, Set is supported because Virtus supports it.
I am think of the same interface as Array has: