# Extending \`Array.of\` behaviour to \`Set\`, \`Range\` etc

**URL:** <https://discourse.dry-rb.org/t/extending-array-of-behaviour-to-set-range-etc/1896>\
**Category:** dry-types\
**Created:** [February 9, 2025, 6:32pm UTC](https://discourse.dry-rb.org/t/extending-array-of-behaviour-to-set-range-etc/1896 "2025-02-09T18:32:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![alassek](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/alassek/32/314_2.png) [@alassek](https://discourse.dry-rb.org/u/alassek)\
**Post date:** [February 17, 2025, 9:05pm UTC](https://discourse.dry-rb.org/t/extending-array-of-behaviour-to-set-range-etc/1896/2 "2025-02-17T21:05:45Z")

</div>

If you’re asking whether dry-types can express this today, not to my knowledge.

`Array.of` works because Arrays are first-class type objects in the system; Set and Range are not, so while you could define nominal types for them, in order to do member type-checking you would need to implement [member classes like Array has](https://github.com/dry-rb/dry-types/blob/main/lib/dry/types/array/member.rb).

But types are not that useful on their own, so in order for schemas and contracts to understand these types, you would also need to introduce [AST](https://dry-rb.org/gems/dry-schema/1.13/advanced/rule-ast/) support for them.

In other words: it would be possible to do this, but it’s high-effort.

---

_[View the full topic](https://discourse.dry-rb.org/t/extending-array-of-behaviour-to-set-range-etc/1896)._
