NAME

MouseX::Types::Data::Monad::Either - Type constraints for Data::Monad::Either

SYNOPSIS

use Data::Monad::Either qw( right left );
use MouseX::Types::Data::Monad::Either;
use Smart::Args qw( args );

sub from_api {
  args my $json => 'Either[Left[Str] | Right[Int]]';
  $json->flat_map(sub {
    # ...
  });
}

from_api(right(1));
from_api(left('some error'));

DESCRIPTION

MouseX::Types::Data::Monad::Either defines a type constraint for Data::Monad::Either.

Either type requires a union type that consists of Left and Right types.

The reason for this strange requirement is that Mouse::Meta::TypeConstraint cannot have multiple type parameters.

SEE ALSO

Mouse, Data::Monad::Either

LICENSE

Copyright (C) aereal.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

aereal <aereal@aereal.org>