From: Matt S Trout Date: Sat, 7 Apr 2018 19:10:28 +0000 (+0000) Subject: fully type Resolution* classes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=22d295940695930eebfbd7d0bd2e7495667cbb49;p=scpubgit%2FDX.git fully type Resolution* classes --- diff --git a/lib/DX/Resolution.pm b/lib/DX/Resolution.pm index 35059dd..a821f7a 100644 --- a/lib/DX/Resolution.pm +++ b/lib/DX/Resolution.pm @@ -3,9 +3,9 @@ package DX::Resolution; use DX::Utils qw(expand_deps); use DX::Class; -has veracity_depends_on => (is => 'ro', required => 1); +has veracity_depends_on => (is => 'ro', required => 1, isa => DependencyList); -has actions => (is => 'ro', required => 1); +has actions => (is => 'ro', required => 1, isa => ArrayRef[Action]); sub next_resolution { $_[0] } diff --git a/lib/DX/ResolutionSpace.pm b/lib/DX/ResolutionSpace.pm index 4d2bd1f..4d6eeb4 100644 --- a/lib/DX/ResolutionSpace.pm +++ b/lib/DX/ResolutionSpace.pm @@ -5,13 +5,15 @@ use DX::Step::ResolveProposition; use DX::Utils qw(expand_deps); use DX::Class; -has proposition => (is => 'ro'); +has proposition => (is => 'ro', isa => Proposition); -has geometry_depends_on => (is => 'ro', required => 1); +has geometry_depends_on => (is => 'ro', required => 1, isa => DependencyList); -has aperture => (is => 'ro', required => 1); +has aperture => (is => 'ro', required => 1, isa => ApertureList); -has members => (is => 'ro', required => 1); +has members => ( + is => 'ro', required => 1, isa => ArrayRef[ResolutionStrategy|Resolution] +); sub for_deparse { my ($self) = @_; diff --git a/lib/DX/ResolutionStrategy.pm b/lib/DX/ResolutionStrategy.pm index 389c406..9deaa85 100644 --- a/lib/DX/ResolutionStrategy.pm +++ b/lib/DX/ResolutionStrategy.pm @@ -1,13 +1,21 @@ package DX::ResolutionStrategy; use DX::Resolution; +use Types::Standard qw(CodeRef Tuple slurpy); use DX::Class; -has action_prototypes => (is => 'ro', required => 1); +has action_prototypes => ( + is => 'ro', required => 1, + isa => ArrayRef[Tuple[Value, Str, slurpy ArrayRef[Value]]] +); -has veracity_depends_on_builder => (is => 'ro', required => 1); +has veracity_depends_on_builder => ( + is => 'ro', required => 1, isa => CodeRef +); -has implementation_candidates => (is => 'ro', required => 1); +has implementation_candidates => ( + is => 'ro', required => 1, isa => ArrayRef[ArrayRef[ArrayRef[Value]]] +); has aperture => (is => 'lazy', builder => sub { my ($self) = @_; diff --git a/lib/DX/Types.pm b/lib/DX/Types.pm index 5a8756f..2482f01 100644 --- a/lib/DX/Types.pm +++ b/lib/DX/Types.pm @@ -15,6 +15,7 @@ use Type::Library qw( DependencyType _DependencyTree DependencySpec One DependencyGroupEntry DependencyGroup ValuePath + EventType ApertureList DependencyList ), ) ; @@ -56,7 +57,7 @@ declare EventType => where { declare _DependencyTree => where { is_DependencyTree($_) }; -declare DependencySpec => as Tuple[DependencyType, slurpy ArrayRef[Str]]; +declare DependencySpec => as Tuple[DependencyType, slurpy ValuePath]; declare DependencyList => as ArrayRef[DependencySpec]; @@ -68,6 +69,8 @@ declare DependencyTree => # [ \%subtree, \%existence_of, ... ] (Optional[Maybe[HashRef[One]]]) x 4 ]]; +declare ApertureList => as ArrayRef[Tuple[EventType, slurpy ValuePath]]; + ## These were from the dependency group thing which makes no sense until ## we have scoping, so revisit it then #