package TestWrapper;
use Moose;

extends 'MooseX::TypeLibrary::Wrapper';
#use Class::C3;
#use base 'MooseX::TypeLibrary::Wrapper';

around type_export_generator => sub {
    my $code = super();
    return sub { $code->(@_) };
};

#sub type_export_generator {
#    my $class = shift;
#    my ($type, $full) = @_;
#    my $code = $class->next::method(@_);
#    return sub { $code->(@_) };
#}

around check_export_generator => sub {
    my $code = super();
    return sub {
        return $code unless @_;
        return $code->(@_);
    };
};

#sub check_export_generator {
#    my $class = shift;
#    my ($type, $full, $undef_msg) = @_;
#    my $code = $class->next::method(@_);
#    return sub {
#        return $code unless @_;
#        return $code->(@_);
#    };
#}

around coercion_export_generator => sub {
    my $code = super();
    return sub {
        my $value = $code->(@_);
        die "coercion returned undef\n" unless defined $value;
        return $value;
    };
};

#sub coercion_export_generator {
#    my $class = shift;
#    my ($type, $full, $undef_msg) = @_;
#    my $code = $class->next::method(@_);
#    return sub {
#        my $val = $code->(@_);
#        die "coercion returned undef\n" unless defined $val;
#        return $val;
#    };
#}

1;
