Skip Menu |
 

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 131011
Status: rejected
Priority: 0/
Queue: Type-Tiny

People
Owner: Nobody in particular
Requestors: CXW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.006000
Fixed in: (no value)



Subject: Request: Types::TypeTiny::to_TypeTiny: add support for Specio::Constraint::Simple
Download (untitled) / with headers
text/plain 476b
Specio::Constraint::Simple* constraints provide value_is_valid() instead of check(), and do not provide get_message. Would you be willing to add support for them to Types::TypeTiny::to_TypeTiny() (or accept a PR to do so)? This is in support of my own work on https://github.com/cxw42/Class-Tiny-ConstrainedAccessor/issues/9 . As far as I can tell, this is not fixed in 1.007_000. Thanks for considering this request! * https://metacpan.org/pod/Specio::Constraint::Simple
Specio does actually provide check and get_message, though they're not documented. check: https://metacpan.org/release/Specio/source/lib/Specio/Constraint/Role/Interface.pm#L597 get_message: https://metacpan.org/release/Specio/source/lib/Specio/Constraint/Role/Interface.pm#L590 Type::Tiny 1.007_000 includes a test fro consuming Specio types: https://metacpan.org/source/TOBYINK/Type-Tiny-1.007_000/t/30-integration/Specio/basic.t Something like this should work: use Specio::Library::Builtins; use Types::Standard 'ArrayRef'; my $ArrayOfInts = ArrayRef[ t('Int') ]; And the resulting type should even support inlining. (In 1.006, I believe it will work, but without inlining support.) For now, I'm happy using check/get_message for Specio, but should Specio drop these methods in the future, I'm prepared to call other methods in their place. The one Specio-related feature that I would like to implement but haven't yet, would be for Type::Utils::extends() to support Specio libraries. I'd certainly welcome other test cases though.
Download (untitled) / with headers
text/plain 1.2k
Ah! UTSL. Thanks for the pointers --- I was indeed going by the Specio documentation. The test case you gave works on my system. Much appreciated! On Mon Nov 18 03:55:12 2019, TOBYINK wrote: Show quoted text
> Specio does actually provide check and get_message, though they're not > documented. > > check: > https://metacpan.org/release/Specio/source/lib/Specio/Constraint/Role/Interface.pm#L597 > > get_message: > https://metacpan.org/release/Specio/source/lib/Specio/Constraint/Role/Interface.pm#L590 > > Type::Tiny 1.007_000 includes a test fro consuming Specio types: > https://metacpan.org/source/TOBYINK/Type-Tiny-1.007_000/t/30- > integration/Specio/basic.t > > Something like this should work: > > use Specio::Library::Builtins; > use Types::Standard 'ArrayRef'; > > my $ArrayOfInts = ArrayRef[ t('Int') ]; > > And the resulting type should even support inlining. (In 1.006, I > believe it will work, but without inlining support.) > > For now, I'm happy using check/get_message for Specio, but should > Specio drop these methods in the future, I'm prepared to call other > methods in their place. > > The one Specio-related feature that I would like to implement but > haven't yet, would be for Type::Utils::extends() to support Specio > libraries. > > I'd certainly welcome other test cases though.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.