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.48
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
72 The source code repository for Specio can be found at
73 <https://github.com/houseabsolute/Specio>.
74
76 Dave Rolsky <autarch@urth.org>
77
79 This software is Copyright (c) 2012 - 2022 by Dave Rolsky.
80
81 This is free software, licensed under:
82
83 The Artistic License 2.0 (GPL Compatible)
84
85 The full text of the license can be found in the LICENSE file included
86 with this distribution.
87
88
89
90perl v5.36.0 2023-01S-p2e0cio::Constraint::Parameterizable(3)