Aion

 view release on metacpan or  search on metacpan

lib/Aion/Types.md  view on Meta::CPAN

## Rat

Rational numbers.

```perl
"6/7" ~~ Rat     # -> 1
"-6/7" ~~ Rat    # -> 1
6 ~~ Rat         # -> 1
"inf" ~~ Rat     # -> 1
"+Inf" ~~ Rat    # -> 1
"NaN" ~~ Rat     # -> 1
"-nan" ~~ Rat    # -> 1
6.5 ~~ Rat       # -> 1
"6.5 " ~~ Rat    # -> ''
```

## Num

The numbers.

```perl

lib/Aion/Types.pm  view on Meta::CPAN

use common::sense;

use Aion::Type;
use Attribute::Handlers;
use List::Util qw/all any/;
use Exporter qw/import/;
use Scalar::Util qw/looks_like_number reftype blessed/;
use Sub::Util qw/prototype set_prototype subname set_subname/;

our @EXPORT = our @EXPORT_OK = grep {
	*{$Aion::Types::{$_}}{CODE}	&& !/^(_|(NaN|import|all|any|looks_like_number|reftype|blessed|prototype|set_prototype|subname|set_subname)\z)/n
} keys %Aion::Types::;

sub UNIVERSAL::Isa : ATTR(CODE) {
    my ($pkg, $symbol, $referent, $attr, $data, $phase, $file, $line) = @_;
    my $args_of_meth = "Arguments of method `" . *{$symbol}{NAME} . "`";
    my $returns_of_meth = "Returns of method `" . *{$symbol}{NAME} . "`";
    my $return_of_meth = "Return of method `" . *{$symbol}{NAME} . "`";

	my @signature = map { ref($_)? $_: $pkg->can($_)->() } @$data;

lib/Aion/Types.pm  view on Meta::CPAN


=head2 Rat

Rational numbers.

	"6/7" ~~ Rat     # -> 1
	"-6/7" ~~ Rat    # -> 1
	6 ~~ Rat         # -> 1
	"inf" ~~ Rat     # -> 1
	"+Inf" ~~ Rat    # -> 1
	"NaN" ~~ Rat     # -> 1
	"-nan" ~~ Rat    # -> 1
	6.5 ~~ Rat       # -> 1
	"6.5 " ~~ Rat    # -> ''

=head2 Num

The numbers.

	-6.5 ~~ Num      # -> 1
	6.5e-7 ~~ Num    # -> 1

t/aion/types.t  view on Meta::CPAN

# ## Rat
# 
# Rational numbers.
# 
done_testing; }; subtest 'Rat' => sub { 
::is scalar do {"6/7" ~~ Rat}, scalar do{1}, '"6/7" ~~ Rat     # -> 1';
::is scalar do {"-6/7" ~~ Rat}, scalar do{1}, '"-6/7" ~~ Rat    # -> 1';
::is scalar do {6 ~~ Rat}, scalar do{1}, '6 ~~ Rat         # -> 1';
::is scalar do {"inf" ~~ Rat}, scalar do{1}, '"inf" ~~ Rat     # -> 1';
::is scalar do {"+Inf" ~~ Rat}, scalar do{1}, '"+Inf" ~~ Rat    # -> 1';
::is scalar do {"NaN" ~~ Rat}, scalar do{1}, '"NaN" ~~ Rat     # -> 1';
::is scalar do {"-nan" ~~ Rat}, scalar do{1}, '"-nan" ~~ Rat    # -> 1';
::is scalar do {6.5 ~~ Rat}, scalar do{1}, '6.5 ~~ Rat       # -> 1';
::is scalar do {"6.5 " ~~ Rat}, scalar do{''}, '"6.5 " ~~ Rat    # -> \'\'';

# 
# ## Num
# 
# The numbers.
# 
done_testing; }; subtest 'Num' => sub { 



( run in 0.250 second using v1.01-cache-2.11-cpan-4d50c553e7e )