Skip Menu |

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

Report information
The Basics
Id: 122408
Status: new
Priority: 0/
Queue: Type-Simple

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

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



Subject: There are already other modules on CPAN that do this
The example in your SYNOPSIS could be: use Types::Standard qw(:all); # simple values Int->check( 123 ); # -> true Int->check( 'xyz' ); # -> false # array and hash references ArrayRef->of(Int)->check( [ 1, 2, 3 ] ); # -> true HashRef->of(Bool)->check( { foo => 1, bar => 0 } ); # -> true # hash references with specific keys and value types Dict->of( foo => Int, bar => Int )->check( { foo => 1 }, ); # -> false, because you didn't provide key "bar" Dict->of( foo => Int, bar => Optional[Int] ), { foo => 1 }, ); # -> true, because "bar" is Optional Types::Standard is already widely used (and thus most of the bugs will have already been found and fixed): https://metacpan.org/requires/distribution/Type-Tiny?sort=[[2,1]]&size=100 It's also *really* fast compared to other type constraint implementations: https://metacpan.org/pod/distribution/Type-Tiny/examples/benchmarking/benchmark-constraints.pl https://metacpan.org/pod/distribution/Type-Tiny/examples/benchmarking/benchmark-param-validation.pl