SlideShare a Scribd company logo
Arrows in Perl
2011.12.10 hiratara
d.hatena.ne.jp/hiratara

twitter.com/hiratara



Perl
d.hatena.ne.jp/hiratara

twitter.com/hiratara



Perl
Perl

Haskell
Perl

Haskell
Perl

Haskell
Perl

Haskell
10/18 YAPC::Asia 2011

Monads in Perl
  Perl Monad

  Future
  (        JSDeferred)
10/18 YAPC::Asia 2011

Monads in Perl
  Perl Monad

  Future
  (        JSDeferred)
10/18 YAPC::Asia 2011

Monads in Perl
  Perl Monad

  Future
  (        JSDeferred)
Data::Monad

my $result = Data::Monad::Base::Sugar::for {
    pick my $x => sub { scalar_list 1 .. 100 };
    pick my $y => sub { scalar_list $x .. 100 };
    pick my $z => sub {
     scalar_list $y .. ($x + $y > 100 ? 100 : $x + $y)
    };
    satisfy { $x**2 + $y**2 == $z**2 };
    yield { $x, $y, $z }
};
return    >>=

return :: a -> m a
>>= :: m a -> (a -> m b) -> m b
return               >>=
ma       mb         mb       mc        ma        mc

     f        >=>        g        ==     f >=> g
a         b         b        c         a        c

ma                  ma       mb        ma        mb
 return       >=>        f        ==         f
a                   a        b         a         b
(2)

                              2



     fmap                return   join

fmap :: a -> b -> (m a -> m b)
join :: m (m a) -> m a
(3)
η⊗id           id⊗η
I⊗M              M⊗M            M⊗I

                     μ
      λ                     ρ

                 M
(                 )
              0×id                   id×0
(*, n)               (0, n) (n, 0)              (n, *)

                              (+)
         π’                             π

                          n
(            )
       fmap return              return
id.fmap            fmap.fmap               fmap.id

                         join
       id                             id

                    fmap
(            )
       fmap return              return
id.fmap            fmap.fmap               fmap.id

                         join
       id                             id

                    fmap
Arrows

John Hughes   2000
Monad    Arrow


                 (Haskell    )
                                 mb

                             f
                         a
Arrows

                         f :: m b c   b
                     a
Arrows

arr >>> first                    ↝

arr :: a -> b -> (a ↝ b)

>>> :: (a ↝ b) -> (b ↝ c) -> (a ↝ c)

first :: (a ↝ b) -> (a × c ↝ b × c)
Arrow
        package Arrow;

        sub arr {
        	 my ($class, $code) = @_;
        	 die "not implemented";
        }

        sub first {
        	 my $self = shift;
        	 die "not implemented";
        }

        sub next {
        	 my ($self, $arrow) = @_;
        	 die "not implemented";
        }
first
     a↝b       a   b

     >>>

     arr           ↝


a          f   b           a      arr f :: a ↝ b
                                                    b

               g   arr   arr f >>> arr g :: a ↝ c
                                                        arr g :: b ↝ c

    g.f
               c                                    c
first
           Arrow ↝

           a                    c   a×c

f :: a↝b             g :: c↝d         f *** g :: a×c↝b×d




           b                    d   b×d
(f *** g) >>> (f’ *** g’)   (f >>> f’) *** (g >>> g’)


      f           g                f          g




       f’         g’               f’        g’
(f *** g) >>> (f’ *** g’)   (f >>> f’) *** (g >>> g’)


      f           g                f          g




       f’         g’               f’        g’
premonoidal category

 f ⋉ id = first f     a×b          a×b
 id ⋊ f = second f
                        f ⋉ id
                     a’×b            (f>>>f’) ⋉ id

                        f’ ⋉ id

                     a’’×b        a’’×b
premonoidal category

 f ⋉ id = first f     a×b          a×b
 id ⋊ f = second f
                        f ⋉ id
                     a’×b            (f>>>f’) ⋉ id

                        f’ ⋉ id

                     a’’×b        a’’×b
central

 f *** g ≡ first f >>> second g
 first f >>> second - = second - >>> first f
 first - >>> second f = second f >>> first -
           f central

 arr f   central

 f |x g ≡ first f >>> second (arr g)
 (                                     10.2)
Freyd category

                     premonoidal category


(central        central          )

           a -> b            Arrow a ↝ b
     arr              Freyd category
first   (   )
second              ***
 sub second {
 	 my $self = shift;
 	 my $swap = (ref $self)->arr(sub { $_[1], $_[0] });
 	 $swap->next($self->first)->next($swap);
 }



 sub parallel {
 	 my ($self, $arrow) = @_;
 	 $self->first->next($arrow->second);
 }

                     fst f >>> snd g
                       id        g
               C            C        D

                       f             id
               A              B            B
&&&
     sub split {
     	 my ($self, $arrow) = @_;
     	 (ref $self)->arr(sub {
     	 	 my $args = [@_];
     	 	 $args, $args;
     	 })->next($self->parallel($arrow));
     }

            A                                         A
                                                                  arr id
                                         arr id
                                                  arr <id, id>
     f                 g             A       arr π
                                                     A×A     arr π’
                                                                           A
            f &&&g               f                                             g
                                                          f *** g
                                             arr π               arr π’
B
    arr π
            B×C   arr π’
                           C         B               B×C                   C
(1):


Perl
f : A×B → C×D
(1):


first :: a × b × c -> d × e
 -> (a × b × c × y × z -> d × e × y × z)
                        5
(1):
 f                              (@v1 )
     sub first {
     	 my $self = shift;
     	 (ref $self)->arr(sub {
     	 	 my (@v1, @v2) = @_;
     	 	 $self->(@v1), @v2;
     	 });
     }




                 first              2
(A × B) × (C × D)
package Arrow::Subroutine;
use parent qw/Arrow/;

sub arr {
	 my ($class, $code) = @_;
	 bless $code, $class;
}

sub first {
	 my $self = shift;
	 (ref $self)->arr(sub {
	 	 my ($v1, $v2) = @_;
	 	 [$self->(@$v1)], $v2;
	 });
}

sub next {
	 my ($self, $arrow) = @_;
	 (ref $self)->arr(sub { $arrow->($self->(@_)) });
}
my $arr3 = Arrow::Subroutine->arr(sub { 3 });
my $arr4 = Arrow::Subroutine->arr(sub { 4 });
my $arrow_add = Arrow::Subroutine->arr(sub {
	 $_[0]->[0] + $_[1]->[0];
});
my $arr3_plus_4 = $arr3->split($arr4)->next($arrow_add);

print $arr3_plus_4->(), "n";


               3
                          π

         ()
               3 &&& 4               +
                         Int×Int             Int
                          π’
               4
(2):


              >>> arr

first
first
       a   π    a×c      π’    c


   f               f×return        return


           π              π’
   mb          mb×mc           mc
                  φ

               m(b×c)
package Arrow::Kleisli;
use parent qw/Arrow/;

sub _safe_name($) {
    my $name = shift;
    $name =~ s|::|__|g;
    return "__$name";
}

sub new_class {
    my $class = shift;
    my ($monad) = @_;

    my $class_name = "$class::" . _safe_name($monad);
    unless ($class_name->isa($class)) {
        no strict qw/refs/;
        @{"$class_name::ISA"} = ($class);
        *{"$class_name::monad"} = sub { $monad };
        *{"$class_name::new_class"} = sub {
            die "Don't call the new_class() method from sub classes.";
        };
    }

    return $class_name;
}

sub monad { die "Implement this method in sub classes" }
...
sub new {
	 my ($class, $kleisli) = @_;
	 bless $kleisli, $class;
}

sub arr {
	 my ($class, $code) = @_;
	 $class->new(sub {
	 	 $class->monad->unit($code->(@_));
	 });
}

sub next {
	 my ($self, $arrow) = @_;
	 (ref $self)->new(sub {
	 	 my @v = @_;
	 	 $self->(@v)->flat_map($arrow);
	 });
}
sub first {
	 my $self = shift;
	 my $class = (ref $self);
	 my $monad = $class->monad;

	   $class->new(sub {
	   	 my ($args1, $args2) = @_;
	   	 $monad->sequence(
	   	 	 $self->(@$args1)->map(sub {[@_]}),
	   	 	 $monad->unit(@$args2)->map(sub {[@_]}),
	   	 );
	   });
}
arr 10
                              arr π

     ()
          arr 10 &&& arr 2             div
                             Int×Int         Int
                              arr π’
            arr 2




div :: Int×Int ↝ Int = Int×Int → Maybe Int
my $class = Arrow::Kleisli->new_class('Data::Monad::Maybe');
my $arrow10 = $class->arr(sub { 10 });
my $arrow2 = $class->arr(sub { 2 });
my $arrow_div = $class->new(sub {
	 $_[1][0] == 0 ? nothing : just ($_[0][0] / $_[1][0]);
});
my $arrow10_div_2 = $arrow10->split($arrow2)-
>next($arrow_div);

my $maybe = $arrow10_div_2->();
print $maybe->is_nothing ? 'NOTHING' : $maybe->value;
print "n";
Arrows

Stream            Arrows
:
Arrows

 mm        join       return
                  m            id



           >>>         arr
 ↝⊗↝              ↝            Hom
(            )

            arr⊗id              id⊗arr
Hom⊗↝                ↝⊗↝                   ↝⊗Hom

                          >>>
        λ                              ρ

                      ↝
Arrows

first

LL       Arrows
http://d.hatena.ne.jp/m-hiyama/20111107/1320624410
Arrows in perl

More Related Content

What's hot

Python decorators
Python decoratorsPython decorators
Python decorators
Alex Su
 
Stupid Awesome Python Tricks
Stupid Awesome Python TricksStupid Awesome Python Tricks
Stupid Awesome Python Tricks
Bryan Helmig
 
Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6
garux
 
Python decorators (中文)
Python decorators (中文)Python decorators (中文)
Python decorators (中文)
Yiwei Chen
 
Get on with Field API
Get on with Field APIGet on with Field API
Get on with Field API
Pablo López Escobés
 
Functional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures editionFunctional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures edition
osfameron
 
Decorators in Python
Decorators in PythonDecorators in Python
Decorators in Python
Ben James
 
Arrays in php
Arrays in phpArrays in php
Arrays in php
Laiby Thomas
 
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачи
Maxim Kulsha
 
PHP 5.4
PHP 5.4PHP 5.4
Pyimproved again
Pyimproved againPyimproved again
Pyimproved again
rik0
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
ujihisa
 
Wx::Perl::Smart
Wx::Perl::SmartWx::Perl::Smart
Wx::Perl::Smart
lichtkind
 
Part 7
Part 7Part 7
Part 7
acearmin
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
Lin Yo-An
 
Descobrindo a linguagem Perl
Descobrindo a linguagem PerlDescobrindo a linguagem Perl
Descobrindo a linguagem Perl
garux
 
Python Fundamentals - Basic
Python Fundamentals - BasicPython Fundamentals - Basic
Python Fundamentals - Basic
Wei-Yuan Chang
 
Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)
James Titcumb
 
Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)
James Titcumb
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
James Titcumb
 

What's hot (20)

Python decorators
Python decoratorsPython decorators
Python decorators
 
Stupid Awesome Python Tricks
Stupid Awesome Python TricksStupid Awesome Python Tricks
Stupid Awesome Python Tricks
 
Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6
 
Python decorators (中文)
Python decorators (中文)Python decorators (中文)
Python decorators (中文)
 
Get on with Field API
Get on with Field APIGet on with Field API
Get on with Field API
 
Functional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures editionFunctional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures edition
 
Decorators in Python
Decorators in PythonDecorators in Python
Decorators in Python
 
Arrays in php
Arrays in phpArrays in php
Arrays in php
 
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачи
 
PHP 5.4
PHP 5.4PHP 5.4
PHP 5.4
 
Pyimproved again
Pyimproved againPyimproved again
Pyimproved again
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
 
Wx::Perl::Smart
Wx::Perl::SmartWx::Perl::Smart
Wx::Perl::Smart
 
Part 7
Part 7Part 7
Part 7
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
 
Descobrindo a linguagem Perl
Descobrindo a linguagem PerlDescobrindo a linguagem Perl
Descobrindo a linguagem Perl
 
Python Fundamentals - Basic
Python Fundamentals - BasicPython Fundamentals - Basic
Python Fundamentals - Basic
 
Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)
 
Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
 

Similar to Arrows in perl

循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
Masahiro Honma
 
Math::Category
Math::CategoryMath::Category
Math::Category
Masahiro Honma
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
pwmosquito
 
Sigma type
Sigma typeSigma type
Sigma type
Dmytro Mitin
 
13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)
Roman Brovko
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기
JangHyuk You
 
Functional perl
Functional perlFunctional perl
Functional perl
Errorific
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
David Golden
 
Зависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим ТалдыкинЗависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим Талдыкин
Юрий Сыровецкий
 
Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6
Workhorse Computing
 
Perl Bag of Tricks - Baltimore Perl mongers
Perl Bag of Tricks  -  Baltimore Perl mongersPerl Bag of Tricks  -  Baltimore Perl mongers
Perl Bag of Tricks - Baltimore Perl mongers
brian d foy
 
Document Classification In PHP
Document Classification In PHPDocument Classification In PHP
Document Classification In PHP
Ian Barber
 
Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)
stasimus
 
Key pat1 1-53
Key pat1 1-53Key pat1 1-53
Key pat1 1-53
chanoknunsp
 
PHP Language Trivia
PHP Language TriviaPHP Language Trivia
PHP Language Trivia
Nikita Popov
 
AA Section 8-1
AA Section 8-1AA Section 8-1
AA Section 8-1
Jimbo Lamb
 
Rのスコープとフレームと環境と
Rのスコープとフレームと環境とRのスコープとフレームと環境と
Rのスコープとフレームと環境と
Takeshi Arabiki
 
PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and output
KavithaK23
 

Similar to Arrows in perl (18)

循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
 
Math::Category
Math::CategoryMath::Category
Math::Category
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
 
Sigma type
Sigma typeSigma type
Sigma type
 
13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기
 
Functional perl
Functional perlFunctional perl
Functional perl
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
 
Зависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим ТалдыкинЗависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим Талдыкин
 
Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6
 
Perl Bag of Tricks - Baltimore Perl mongers
Perl Bag of Tricks  -  Baltimore Perl mongersPerl Bag of Tricks  -  Baltimore Perl mongers
Perl Bag of Tricks - Baltimore Perl mongers
 
Document Classification In PHP
Document Classification In PHPDocument Classification In PHP
Document Classification In PHP
 
Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)
 
Key pat1 1-53
Key pat1 1-53Key pat1 1-53
Key pat1 1-53
 
PHP Language Trivia
PHP Language TriviaPHP Language Trivia
PHP Language Trivia
 
AA Section 8-1
AA Section 8-1AA Section 8-1
AA Section 8-1
 
Rのスコープとフレームと環境と
Rのスコープとフレームと環境とRのスコープとフレームと環境と
Rのスコープとフレームと環境と
 
PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and output
 

More from Masahiro Honma

レンズ (ぶつかり稽古の没プレゼン)
レンズ (ぶつかり稽古の没プレゼン)レンズ (ぶつかり稽古の没プレゼン)
レンズ (ぶつかり稽古の没プレゼン)
Masahiro Honma
 
すべてが@__kanになる
すべてが@__kanになるすべてが@__kanになる
すべてが@__kanになる
Masahiro Honma
 
Types and perl language
Types and perl languageTypes and perl language
Types and perl language
Masahiro Honma
 
Currying in perl
Currying in perlCurrying in perl
Currying in perl
Masahiro Honma
 
カレーとHokkaidopm
カレーとHokkaidopmカレーとHokkaidopm
カレーとHokkaidopm
Masahiro Honma
 
モナモナ言うモナド入門.tar.gz
モナモナ言うモナド入門.tar.gzモナモナ言うモナド入門.tar.gz
モナモナ言うモナド入門.tar.gz
Masahiro Honma
 
モナモナ言うモナド入門
モナモナ言うモナド入門モナモナ言うモナド入門
モナモナ言うモナド入門
Masahiro Honma
 
Perl saved a lady.
Perl saved a lady.Perl saved a lady.
Perl saved a lady.
Masahiro Honma
 
Levenshtein Automata
Levenshtein AutomataLevenshtein Automata
Levenshtein Automata
Masahiro Honma
 
20120526 hachioji.pm
20120526 hachioji.pm20120526 hachioji.pm
20120526 hachioji.pm
Masahiro Honma
 
Hachioji.pm in Machida の LT
Hachioji.pm in Machida の LTHachioji.pm in Machida の LT
Hachioji.pm in Machida の LT
Masahiro Honma
 
ウヰスキーとPSGI
ウヰスキーとPSGIウヰスキーとPSGI
ウヰスキーとPSGI
Masahiro Honma
 
モデルから知るGit
モデルから知るGitモデルから知るGit
モデルから知るGit
Masahiro Honma
 
YAPCレポートの舞台裏
YAPCレポートの舞台裏YAPCレポートの舞台裏
YAPCレポートの舞台裏
Masahiro Honma
 
Git入門
Git入門Git入門
Git入門
Masahiro Honma
 
AnyEvent and Plack
AnyEvent and PlackAnyEvent and Plack
AnyEvent and Plack
Masahiro Honma
 
Stateモナドの解説 後編
Stateモナドの解説 後編Stateモナドの解説 後編
Stateモナドの解説 後編
Masahiro Honma
 
Stateモナドの解説 中編
Stateモナドの解説 中編Stateモナドの解説 中編
Stateモナドの解説 中編
Masahiro Honma
 
Stateモナドの解説 前編
Stateモナドの解説 前編Stateモナドの解説 前編
Stateモナドの解説 前編
Masahiro Honma
 
定理3
定理3定理3
定理3
Masahiro Honma
 

More from Masahiro Honma (20)

レンズ (ぶつかり稽古の没プレゼン)
レンズ (ぶつかり稽古の没プレゼン)レンズ (ぶつかり稽古の没プレゼン)
レンズ (ぶつかり稽古の没プレゼン)
 
すべてが@__kanになる
すべてが@__kanになるすべてが@__kanになる
すべてが@__kanになる
 
Types and perl language
Types and perl languageTypes and perl language
Types and perl language
 
Currying in perl
Currying in perlCurrying in perl
Currying in perl
 
カレーとHokkaidopm
カレーとHokkaidopmカレーとHokkaidopm
カレーとHokkaidopm
 
モナモナ言うモナド入門.tar.gz
モナモナ言うモナド入門.tar.gzモナモナ言うモナド入門.tar.gz
モナモナ言うモナド入門.tar.gz
 
モナモナ言うモナド入門
モナモナ言うモナド入門モナモナ言うモナド入門
モナモナ言うモナド入門
 
Perl saved a lady.
Perl saved a lady.Perl saved a lady.
Perl saved a lady.
 
Levenshtein Automata
Levenshtein AutomataLevenshtein Automata
Levenshtein Automata
 
20120526 hachioji.pm
20120526 hachioji.pm20120526 hachioji.pm
20120526 hachioji.pm
 
Hachioji.pm in Machida の LT
Hachioji.pm in Machida の LTHachioji.pm in Machida の LT
Hachioji.pm in Machida の LT
 
ウヰスキーとPSGI
ウヰスキーとPSGIウヰスキーとPSGI
ウヰスキーとPSGI
 
モデルから知るGit
モデルから知るGitモデルから知るGit
モデルから知るGit
 
YAPCレポートの舞台裏
YAPCレポートの舞台裏YAPCレポートの舞台裏
YAPCレポートの舞台裏
 
Git入門
Git入門Git入門
Git入門
 
AnyEvent and Plack
AnyEvent and PlackAnyEvent and Plack
AnyEvent and Plack
 
Stateモナドの解説 後編
Stateモナドの解説 後編Stateモナドの解説 後編
Stateモナドの解説 後編
 
Stateモナドの解説 中編
Stateモナドの解説 中編Stateモナドの解説 中編
Stateモナドの解説 中編
 
Stateモナドの解説 前編
Stateモナドの解説 前編Stateモナドの解説 前編
Stateモナドの解説 前編
 
定理3
定理3定理3
定理3
 

Recently uploaded

Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 

Recently uploaded (20)

Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 

Arrows in perl

  • 8.
  • 9. 10/18 YAPC::Asia 2011 Monads in Perl Perl Monad Future ( JSDeferred)
  • 10. 10/18 YAPC::Asia 2011 Monads in Perl Perl Monad Future ( JSDeferred)
  • 11. 10/18 YAPC::Asia 2011 Monads in Perl Perl Monad Future ( JSDeferred)
  • 12. Data::Monad my $result = Data::Monad::Base::Sugar::for { pick my $x => sub { scalar_list 1 .. 100 }; pick my $y => sub { scalar_list $x .. 100 }; pick my $z => sub { scalar_list $y .. ($x + $y > 100 ? 100 : $x + $y) }; satisfy { $x**2 + $y**2 == $z**2 }; yield { $x, $y, $z } };
  • 13. return >>= return :: a -> m a >>= :: m a -> (a -> m b) -> m b return >>=
  • 14. ma mb mb mc ma mc f >=> g == f >=> g a b b c a c ma ma mb ma mb return >=> f == f a a b a b
  • 15. (2) 2 fmap return join fmap :: a -> b -> (m a -> m b) join :: m (m a) -> m a
  • 16. (3)
  • 17. η⊗id id⊗η I⊗M M⊗M M⊗I μ λ ρ M
  • 18. ( ) 0×id id×0 (*, n) (0, n) (n, 0) (n, *) (+) π’ π n
  • 19. ( ) fmap return return id.fmap fmap.fmap fmap.id join id id fmap
  • 20. ( ) fmap return return id.fmap fmap.fmap fmap.id join id id fmap
  • 21.
  • 23. Monad Arrow (Haskell ) mb f a Arrows f :: m b c b a
  • 24. Arrows arr >>> first ↝ arr :: a -> b -> (a ↝ b) >>> :: (a ↝ b) -> (b ↝ c) -> (a ↝ c) first :: (a ↝ b) -> (a × c ↝ b × c)
  • 25. Arrow package Arrow; sub arr { my ($class, $code) = @_; die "not implemented"; } sub first { my $self = shift; die "not implemented"; } sub next { my ($self, $arrow) = @_; die "not implemented"; }
  • 26. first a↝b a b >>> arr ↝ a f b a arr f :: a ↝ b b g arr arr f >>> arr g :: a ↝ c arr g :: b ↝ c g.f c c
  • 27. first Arrow ↝ a c a×c f :: a↝b g :: c↝d f *** g :: a×c↝b×d b d b×d
  • 28. (f *** g) >>> (f’ *** g’) (f >>> f’) *** (g >>> g’) f g f g f’ g’ f’ g’
  • 29. (f *** g) >>> (f’ *** g’) (f >>> f’) *** (g >>> g’) f g f g f’ g’ f’ g’
  • 30. premonoidal category f ⋉ id = first f a×b a×b id ⋊ f = second f f ⋉ id a’×b (f>>>f’) ⋉ id f’ ⋉ id a’’×b a’’×b
  • 31. premonoidal category f ⋉ id = first f a×b a×b id ⋊ f = second f f ⋉ id a’×b (f>>>f’) ⋉ id f’ ⋉ id a’’×b a’’×b
  • 32. central f *** g ≡ first f >>> second g first f >>> second - = second - >>> first f first - >>> second f = second f >>> first - f central arr f central f |x g ≡ first f >>> second (arr g) ( 10.2)
  • 33. Freyd category premonoidal category (central central ) a -> b Arrow a ↝ b arr Freyd category
  • 34. first ( )
  • 35. second *** sub second { my $self = shift; my $swap = (ref $self)->arr(sub { $_[1], $_[0] }); $swap->next($self->first)->next($swap); } sub parallel { my ($self, $arrow) = @_; $self->first->next($arrow->second); } fst f >>> snd g id g C C D f id A B B
  • 36. &&& sub split { my ($self, $arrow) = @_; (ref $self)->arr(sub { my $args = [@_]; $args, $args; })->next($self->parallel($arrow)); } A A arr id arr id arr <id, id> f g A arr π A×A arr π’ A f &&&g f g f *** g arr π arr π’ B arr π B×C arr π’ C B B×C C
  • 37. (1): Perl f : A×B → C×D
  • 38. (1): first :: a × b × c -> d × e -> (a × b × c × y × z -> d × e × y × z) 5
  • 39. (1): f (@v1 ) sub first { my $self = shift; (ref $self)->arr(sub { my (@v1, @v2) = @_; $self->(@v1), @v2; }); } first 2 (A × B) × (C × D)
  • 40. package Arrow::Subroutine; use parent qw/Arrow/; sub arr { my ($class, $code) = @_; bless $code, $class; } sub first { my $self = shift; (ref $self)->arr(sub { my ($v1, $v2) = @_; [$self->(@$v1)], $v2; }); } sub next { my ($self, $arrow) = @_; (ref $self)->arr(sub { $arrow->($self->(@_)) }); }
  • 41. my $arr3 = Arrow::Subroutine->arr(sub { 3 }); my $arr4 = Arrow::Subroutine->arr(sub { 4 }); my $arrow_add = Arrow::Subroutine->arr(sub { $_[0]->[0] + $_[1]->[0]; }); my $arr3_plus_4 = $arr3->split($arr4)->next($arrow_add); print $arr3_plus_4->(), "n"; 3 π () 3 &&& 4 + Int×Int Int π’ 4
  • 42. (2): >>> arr first
  • 43. first a π a×c π’ c f f×return return π π’ mb mb×mc mc φ m(b×c)
  • 44. package Arrow::Kleisli; use parent qw/Arrow/; sub _safe_name($) { my $name = shift; $name =~ s|::|__|g; return "__$name"; } sub new_class { my $class = shift; my ($monad) = @_; my $class_name = "$class::" . _safe_name($monad); unless ($class_name->isa($class)) { no strict qw/refs/; @{"$class_name::ISA"} = ($class); *{"$class_name::monad"} = sub { $monad }; *{"$class_name::new_class"} = sub { die "Don't call the new_class() method from sub classes."; }; } return $class_name; } sub monad { die "Implement this method in sub classes" } ...
  • 45. sub new { my ($class, $kleisli) = @_; bless $kleisli, $class; } sub arr { my ($class, $code) = @_; $class->new(sub { $class->monad->unit($code->(@_)); }); } sub next { my ($self, $arrow) = @_; (ref $self)->new(sub { my @v = @_; $self->(@v)->flat_map($arrow); }); }
  • 46. sub first { my $self = shift; my $class = (ref $self); my $monad = $class->monad; $class->new(sub { my ($args1, $args2) = @_; $monad->sequence( $self->(@$args1)->map(sub {[@_]}), $monad->unit(@$args2)->map(sub {[@_]}), ); }); }
  • 47. arr 10 arr π () arr 10 &&& arr 2 div Int×Int Int arr π’ arr 2 div :: Int×Int ↝ Int = Int×Int → Maybe Int
  • 48. my $class = Arrow::Kleisli->new_class('Data::Monad::Maybe'); my $arrow10 = $class->arr(sub { 10 }); my $arrow2 = $class->arr(sub { 2 }); my $arrow_div = $class->new(sub { $_[1][0] == 0 ? nothing : just ($_[0][0] / $_[1][0]); }); my $arrow10_div_2 = $arrow10->split($arrow2)- >next($arrow_div); my $maybe = $arrow10_div_2->(); print $maybe->is_nothing ? 'NOTHING' : $maybe->value; print "n";
  • 49. Arrows Stream Arrows
  • 50. : Arrows mm join return m id >>> arr ↝⊗↝ ↝ Hom
  • 51. ( ) arr⊗id id⊗arr Hom⊗↝ ↝⊗↝ ↝⊗Hom >>> λ ρ ↝

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. &amp;#x3010;5&amp;#x5206;&amp;#x3011;\n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. &amp;#x3010;10&amp;#x5206;&amp;#x3011;\n
  25. \n
  26. &amp;#x9EC4;&amp;#x8272;&amp;#x306E;&amp;#x90E8;&amp;#x5206;&amp;#x304C;&amp;#x95A2;&amp;#x6570;&amp;#x3067;&amp;#x306F;&amp;#x306A;&amp;#x304F;&amp;#x578B;&amp;#x306A;&amp;#x306E;&amp;#x304C;&amp;#x30DD;&amp;#x30A4;&amp;#x30F3;&amp;#x30C8;&amp;#x3002;\n
  27. \n
  28. \n
  29. &amp;#x7D50;&amp;#x5408;&amp;#x5247;&amp;#x3092;&amp;#x6E80;&amp;#x305F;&amp;#x3059;&amp;#x3088;&amp;#x3046;&amp;#x306A;&amp;#x5B9A;&amp;#x7FA9;&amp;#x3092;&amp;#x3057;&amp;#x3066;&amp;#x304A;&amp;#x3044;&amp;#x305F;&amp;#x65B9;&amp;#x304C;&amp;#x53B3;&amp;#x5BC6;&amp;#x3060;&amp;#x3057;&amp;#x4F7F;&amp;#x3044;&amp;#x3084;&amp;#x3059;&amp;#x3044;\n
  30. \n
  31. &amp;#x3010;15&amp;#x5206;&amp;#x3011;\n
  32. \n
  33. &amp;#x4EFB;&amp;#x610F;&amp;#x306E;&amp;#x30A2;&amp;#x30ED;&amp;#x30FC;&amp;#x306B;&amp;#x5BFE;&amp;#x3057;&amp;#x3066;&amp;#x540C;&amp;#x3058;&amp;#x5B9F;&amp;#x88C5;&amp;#x304C;&amp;#x5229;&amp;#x7528;&amp;#x53EF;&amp;#x80FD;&amp;#x3002;&amp;#x62BD;&amp;#x8C61;&amp;#x5316;&amp;#x306E;&amp;#x52B9;&amp;#x529B;&amp;#x3002;\n
  34. &amp;#x4EFB;&amp;#x610F;&amp;#x306E;&amp;#x30A2;&amp;#x30ED;&amp;#x30FC;&amp;#x306B;&amp;#x5BFE;&amp;#x3057;&amp;#x3066;&amp;#x540C;&amp;#x3058;&amp;#x5B9F;&amp;#x88C5;&amp;#x304C;&amp;#x5229;&amp;#x7528;&amp;#x53EF;&amp;#x80FD;&amp;#x3002;&amp;#x62BD;&amp;#x8C61;&amp;#x5316;&amp;#x306E;&amp;#x52B9;&amp;#x529B;&amp;#x3002;\n
  35. \n
  36. \n
  37. \n
  38. &amp;#x3010;20&amp;#x5206;&amp;#x3011;\n
  39. \n
  40. \n
  41. \n
  42. &amp;#x30E2;&amp;#x30CA;&amp;#x30C9;&amp;#x3092;&amp;#x578B;&amp;#x30D1;&amp;#x30E9;&amp;#x30E1;&amp;#x30FC;&amp;#x30BF;&amp;#x3068;&amp;#x3057;&amp;#x3066;&amp;#x6271;&amp;#x3046;&amp;#x305F;&amp;#x3081;&amp;#x306E;&amp;#x304A;&amp;#x307E;&amp;#x3058;&amp;#x306A;&amp;#x3044;\n
  43. return&amp;#x3084;bind&amp;#x3092;arrow&amp;#x306E;&amp;#x8A00;&amp;#x8449;&amp;#x306B;&amp;#x7FFB;&amp;#x8A33;&amp;#x3057;&amp;#x3066;&amp;#x308B;&amp;#x3060;&amp;#x3051;\n
  44. &amp;#x3055;&amp;#x3063;&amp;#x304D;&amp;#x306E;&amp;#x56F3;&amp;#x3092;&amp;#x5143;&amp;#x306B;&amp;#x5B9F;&amp;#x88C5;&amp;#x3002;map&amp;#x306E;&amp;#x8FBA;&amp;#x308A;&amp;#x306F;&amp;#x578B;&amp;#x3092;&amp;#x305D;&amp;#x308D;&amp;#x3048;&amp;#x308B;&amp;#x304A;&amp;#x307E;&amp;#x3058;&amp;#x306A;&amp;#x3044;\n
  45. &amp;#x3010;25&amp;#x5206;&amp;#x3011;&amp;#x3088;&amp;#x304F;&amp;#x3042;&amp;#x308B;0&amp;#x9664;&amp;#x7B97;&amp;#x306E;&amp;#x4F8B;\n
  46. &amp;#x3088;&amp;#x304F;&amp;#x3042;&amp;#x308B;0&amp;#x9664;&amp;#x7B97;&amp;#x306E;&amp;#x4F8B;\n
  47. \n
  48. &amp;#x4E0A;&amp;#x306F;&amp;#x81EA;&amp;#x5DF1;&amp;#x95A2;&amp;#x624B;&amp;#x570F;&amp;#x3002;&amp;#x4E0B;&amp;#x306F;Profunctor&amp;#x306E;&amp;#x570F;&amp;#x3002;&amp;#x4E0B;&amp;#x306E;&amp;#x65B9;&amp;#x304C;&amp;#x9065;&amp;#x304B;&amp;#x306B;&amp;#x96E3;&amp;#x3057;&amp;#x304F;&amp;#x3066;&amp;#x3088;&amp;#x304F;&amp;#x308F;&amp;#x304B;&amp;#x3089;&amp;#x306A;&amp;#x3044;&amp;#x3002;&amp;#x7279;&amp;#x306B; &amp;#x2297;&amp;#x306E;&amp;#x5B9A;&amp;#x7FA9;\n
  49. \n
  50. \n
  51. \n
  52. \n