From: Matt S Trout Date: Thu, 16 Feb 2017 17:57:50 +0000 (+0000) Subject: add types to EnterRecheck step X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d6fabec9038be8d047ec177fe949694c744a0d2d;p=scpubgit%2FDX.git add types to EnterRecheck step --- diff --git a/lib/DX/Class.pm b/lib/DX/Class.pm index c42d52e..8bdef5d 100644 --- a/lib/DX/Class.pm +++ b/lib/DX/Class.pm @@ -6,6 +6,7 @@ sub import { strictures->import::into(1); # should pass version DX::Types->import::into(1, ':types', ':assert'); DX::Utils->import::into(1, '*trace'); + Types::Standard->import::into(1, 'Maybe'); Try::Tiny->import::into(1); Moo->import::into(1); # This would not be safe with method modifiers, but since the role diff --git a/lib/DX/Step/EnterRecheck.pm b/lib/DX/Step/EnterRecheck.pm index 9bb3564..2b17453 100644 --- a/lib/DX/Step/EnterRecheck.pm +++ b/lib/DX/Step/EnterRecheck.pm @@ -7,11 +7,13 @@ use DX::Class; with 'DX::Role::Step'; -has proposition_list => (is => 'ro', required => 1); +has proposition_list => ( + is => 'ro', isa => PropositionList, required => 1 +); -has on_completion_step => (is => 'ro', required => 1); +has on_completion_step => (is => 'ro', isa => Step, required => 1); -has on_failure_step => (is => 'ro', required => 1); +has on_failure_step => (is => 'ro', isa => Maybe[Step], required => 1); sub apply_to { my ($self, $old_ss) = @_; diff --git a/lib/DX/Types.pm b/lib/DX/Types.pm index 2d3237d..28b610a 100644 --- a/lib/DX/Types.pm +++ b/lib/DX/Types.pm @@ -12,7 +12,7 @@ use Type::Library Step Action ActionPolicy Predicate Value )), qw( - DependencyType _DependencyTree DependecySpec + DependencyType _DependencyTree DependencySpec One DependencyGroupEntry DependencyGroup ), ) @@ -33,6 +33,8 @@ foreach my $role (our @ROLES) { class_type DictValue => { class => 'DX::Value::Dict' }; +declare PropositionList => as ArrayRef[Proposition]; + declare AdjustmentList => as ArrayRef[Tuple[Step, SearchState]]; declare DependencyType => where { @@ -53,6 +55,8 @@ declare _DependencyTree => where { is_DependencyTree($_) }; declare DependencySpec => as Tuple[DependencyType, slurpy ArrayRef[Str]]; +declare DependencyList => as ArrayRef[DependencySpec]; + declare One => where { !ref($_) and $_ eq 1 }; declare DependencyTree => # [ \%subtree, \%existence_of, ... ]