dry-types icon indicating copy to clipboard operation
dry-types copied to clipboard

Intersection (&) support redux

Open robhanlon22 opened this issue 3 years ago • 3 comments

dry-schema and dry-logic both support &. Adding support for & in dry-types allows for a more expressive type system...

module Types
  Callable = Interface(:call)
  Procable = Interface(:to_proc)
  Function = Callable & Procable
end

...and greatly simplifies value coercion in dry-schema, where a custom types merge attempts to simulate an intersection type.

robhanlon22 avatar Aug 20 '22 01:08 robhanlon22

@flash-gordon any thoughts on this? I reopened and finished this work because of the comments in the original intersection support PR (#442) and that it would make downstream & composition in dry-schema less hacky. There's also a matching implication support PR (#446) as well as a composition refactor PR (#447) as well that could make this support generally more holistic.

robhanlon22 avatar Sep 19 '22 17:09 robhanlon22

@robhanlon22 I haven't looked in details yet, but I'm positive overall. I'll get back to this probably next week (traveling atm). Thanks for working on this ❤️

flash-gordon avatar Sep 21 '22 16:09 flash-gordon

Enjoy your trip @flash-gordon !

robhanlon22 avatar Sep 21 '22 16:09 robhanlon22

I'll be merging the PRs, I'll post-review them

flash-gordon avatar Oct 18 '22 09:10 flash-gordon

They all look good at the first glance btw

flash-gordon avatar Oct 18 '22 09:10 flash-gordon