Personally I love dry-types and the composition it allows.
Our lib/types.rb keeps growing and I wonder what kind of “common types” people build.
I was even considering building a contrib package with some of those “common” utilities.
Some features are not fully documented in the website like >>, >, & but I find them very eloquent.
Lately I’ve been playing with the >> composition.
module Types
Type = Types.Instance(Dry::Types::Type)
Sum = Types.Instance(Dry::Types::Sum)
Undefined = Dry::Types::Undefined
SquishedString = Types::Coercible::String >> :squish.to_proc
CapitalizedString = SquishedString >> :capitalize.to_proc
LowercaseString = SquishedString >> :downcase.to_proc
end
Mostly I wanted to create an utility belt for our internal typechecks with some common tools and coercions so the mental gymnastics are less convoluted. We do have constructs like UniqueArray but I wonder what people create out there and if it’d make sense to put something together