| 1 | # | ||
| 2 | # Copyright (c) 2015-2020 Christian Jaeger, copying@christianjaeger.ch | ||
| 3 | # | ||
| 4 | # This is free software, offered under either the same terms as perl 5 | ||
| 5 | # or the terms of the Artistic License version 2 or the terms of the | ||
| 6 | # MIT License (Expat version). See the file COPYING.md that came | ||
| 7 | # bundled with this file. | ||
| 8 | # | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | FP::Abstract::Pure - functional purity protocol | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | 1 | ▶ | use FP::List; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 1 | ▶ | use Safe::Isa; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | my $v = list(1); # or any other data structure that implements | ||
| 19 | # FP::Abstract::Pure | ||
| 20 | is $v->$_isa("FP::Abstract::Pure"), 1; | ||
| 21 | |||
| 22 | # but usually: | ||
| 23 | 1 | ▶ | use FP::Predicates; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | is_pure($v) # true if $v does (officially) not support mutation | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | Base class for all data structures that don't allow mutation (by | ||
| 29 | ordinary programs), i.e. are | ||
| 30 | L<persistent|https://en.wikipedia.org/wiki/Persistent_data_structure>. | ||
| 31 | |||
| 32 | More precisely, those objects that don't have methods that when called | ||
| 33 | make other methods non-functions. | ||
| 34 | |||
| 35 | =head1 NOTE | ||
| 36 | |||
| 37 | This is alpha software! Read the status section in the package README | ||
| 38 | or on the L<website|http://functional-perl.org/>. | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | package FP::Abstract::Pure; | ||
| 43 | |||
| 44 | 61 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | 61 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | 61 | ▶ | use warnings FATAL => 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 47 | |||
| 48 | 303 | ▶ | sub FP_Interface__method_names { () } |
|
Subroutine
FP_Interface__method_names: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | |||
| 50 | 61 | 1 | |