1Specio::Constraint::ParUasmeerteCroinztarbilbeu(t3e)d PeSrplecDiooc:u:mCeonntsattriaoinnt::Parameterizable(3)
2
3
4
6 Specio::Constraint::Parameterizable - A class which represents
7 parameterizable constraints
8
10 version 0.46
11
13 my $arrayref = t('ArrayRef');
14
15 my $arrayref_of_int = $arrayref->parameterize( of => t('Int') );
16
18 This class implements the API for parameterizable types like "ArrayRef"
19 and "Maybe".
20
22 This class implements the same API as Specio::Constraint::Simple, with
23 a few additions.
24
25 Specio::Constraint::Parameterizable->new(...)
26 This class's constructor accepts two additional parameters:
27
28 · parameterized_constraint_generator
29
30 This is a subroutine that generates a new constraint subroutine
31 when the type is parameterized.
32
33 It will be called as a method on the type and will be passed a
34 single argument, the type object for the type parameter.
35
36 This parameter is mutually exclusive with the
37 "parameterized_inline_generator" parameter.
38
39 · parameterized_inline_generator
40
41 This is a subroutine that generates a new inline generator
42 subroutine when the type is parameterized.
43
44 It will be called as a method on the
45 Specio::Constraint::Parameterized object when that object needs to
46 generate an inline constraint. It will receive the type parameter
47 as the first argument and the variable name as a string as the
48 second.
49
50 This probably seems fairly confusing, so looking at the examples in
51 the Specio::Library::Builtins code may be helpful.
52
53 This parameter is mutually exclusive with the
54 "parameterized_constraint_generator" parameter.
55
56 $type->parameterize(...)
57 This method takes two arguments. The "of" argument should be an object
58 which does the Specio::Constraint::Role::Interface role, and is
59 required.
60
61 The other argument, "declared_at", is optional. If it is not given,
62 then a new Specio::DeclaredAt object is creating using a call stack
63 depth of 1.
64
65 This method returns a new Specio::Constraint::Parameterized object.
66
68 Bugs may be submitted at
69 <https://github.com/houseabsolute/Specio/issues>.
70
71 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
72
74 The source code repository for Specio can be found at
75 <https://github.com/houseabsolute/Specio>.
76
78 Dave Rolsky <autarch@urth.org>
79
81 This software is Copyright (c) 2012 - 2020 by Dave Rolsky.
82
83 This is free software, licensed under:
84
85 The Artistic License 2.0 (GPL Compatible)
86
87 The full text of the license can be found in the LICENSE file included
88 with this distribution.
89
90
91
92perl v5.32.0 2020-07S-p2e8cio::Constraint::Parameterizable(3)