X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FDependent%2FTypes.pm;h=8ad9ad424bfcbd6bac05da6edc27b2dd6ba8c9be;hb=6b2f4f88343da76848e1fe1a98f9a289bf555055;hp=6053dfbf3ff33c0ce25828185e178b789950e3b6;hpb=c4be107ab0f2555746d2696fca23710de930aa60;p=gitmo%2FMooseX-Dependent.git diff --git a/lib/MooseX/Dependent/Types.pm b/lib/MooseX/Dependent/Types.pm index 6053dfb..8ad9ad4 100644 --- a/lib/MooseX/Dependent/Types.pm +++ b/lib/MooseX/Dependent/Types.pm @@ -133,6 +133,9 @@ is a capacity we current don't have. =head2 Coercions +You can place coercions on dependent types, however you need to pay attention to +what you are actually coercion, the unparameterized or parameterized constraint. + TBD: Need discussion and example of coercions working for both the constrainted and dependent type constraint. @@ -145,8 +148,11 @@ is a capacity we current don't have. Which should work like: - OlderThanAge[{older_than=>25}]->check(39); ## is OK - + OlderThanAge[{older_than=>25}]->check(39); ## is OK + OlderThanAge[older_than=>1]->check(9); ## OK, using reference type inference + +And you can create coercions like: + coerce OlderThanAge, from Tuple[Int, Int], via {