From: John Napiorkowski Date: Mon, 18 May 2009 02:21:03 +0000 (-0400) Subject: more specs for coercions X-Git-Tag: 0.01~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b2f4f88343da76848e1fe1a98f9a289bf555055;p=gitmo%2FMooseX-Dependent.git more specs for coercions --- 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 {