SlideShare ist ein Scribd-Unternehmen logo
1 von 7
Downloaden Sie, um offline zu lesen
.
        ProFunctor and Arrow
        – profunctors hackage library –
.

    Kei Hibino : http://twitter.com/khibino


                  2013-03-31



                                .   .     .   .   .   .
Functor


  Functor f = > f b
  Functor ( a - >) = > ( a - >) b
    --- 終域だけ - only co - domain

  fmap :: ( a -> b ) -> f a -> f b
    --- 終域を変える - map co - domain




                          .   .   .   .   .   .
Arrow
  Arrow   a => a b c
  Arrow   ( - >) = > ( - >) b c
     ---  始域と終域が両方ある
     ---  both domain and co - domain
  (^ > >) :: Arrow a = >
               ( b -> c ) -> a c d -> a b d
                                ^       ^
     --- 始域を変える - map domain
  (^ < <) :: Arrow a = >
               ( c -> d ) -> a b c -> a b d
                                  ^       ^
     --- 終域を変える - map co - domain
                            .   .   .   .   .   .
ProFunctor

  ProFunctor p = > p a b
    --- 始域と終域が両方ある
    --- both domain and co - domain
  lmap :: ProFunctor p = >
          ( b -> c ) -> p c d -> p b d
                          ^         ^
    --- 始域を変える - map domain
  rmap :: ProFunctor p = >
          ( b -> c ) -> p a b -> p a c
                            ^         ^
    --- 終域を変える - map co - domain

                          .   .   .   .   .   .
Strong type class in profunctors



  first ’ :: p a b -> p (a , c ) (b , c )
  second ’ :: p a b -> p (c , a ) (c , b )

  Arrow ( first , second )




                             .   .   .   .   .   .
Choice type class in profunctors


  left ’  :: p   a b ->
             p   ( Either a c ) ( Either b c )
  right ’ :: p   a b ->
             p   ( Either c a ) ( Either c b )

  ArrowChoice ( left , right )




                             .   .   .   .   .   .
Conclusion




  ProFunctor は Arrow の制約を分割して提供してい
  るイメージ




                        .   .   .   .   .   .

Weitere ähnliche Inhalte

Was ist angesagt?

Sequential pattern mining
Sequential pattern miningSequential pattern mining
Sequential pattern mining
kiran said
 
Hacker Thursdays: An introduction to binary exploitation
Hacker Thursdays: An introduction to binary exploitationHacker Thursdays: An introduction to binary exploitation
Hacker Thursdays: An introduction to binary exploitation
OWASP Hacker Thursday
 
Jillians Potw
Jillians PotwJillians Potw
Jillians Potw
sabsma
 
Jillian Fluet’S Potw Solution
Jillian Fluet’S Potw SolutionJillian Fluet’S Potw Solution
Jillian Fluet’S Potw Solution
jillianfluet
 

Was ist angesagt? (19)

Memory efficient pytorch
Memory efficient pytorchMemory efficient pytorch
Memory efficient pytorch
 
When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)
 
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operators
 
Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
 
Fp in scala with adts
Fp in scala with adtsFp in scala with adts
Fp in scala with adts
 
Lecture 05 Association Rules Advanced Topics
Lecture 05 Association  Rules  Advanced  TopicsLecture 05 Association  Rules  Advanced  Topics
Lecture 05 Association Rules Advanced Topics
 
Sequential pattern mining
Sequential pattern miningSequential pattern mining
Sequential pattern mining
 
4 Type conversion functions
4 Type conversion functions4 Type conversion functions
4 Type conversion functions
 
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
 
Stack
StackStack
Stack
 
Ch9a
Ch9aCh9a
Ch9a
 
Advanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriterAdvanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriter
 
Matlab Code for Bisection methode
Matlab Code for Bisection methode Matlab Code for Bisection methode
Matlab Code for Bisection methode
 
Hacker Thursdays: An introduction to binary exploitation
Hacker Thursdays: An introduction to binary exploitationHacker Thursdays: An introduction to binary exploitation
Hacker Thursdays: An introduction to binary exploitation
 
Efficient Random-Walk Methods forApproximating Polytope Volume
Efficient Random-Walk Methods forApproximating Polytope VolumeEfficient Random-Walk Methods forApproximating Polytope Volume
Efficient Random-Walk Methods forApproximating Polytope Volume
 
Jillians Potw
Jillians PotwJillians Potw
Jillians Potw
 
Jillian Fluet’S Potw Solution
Jillian Fluet’S Potw SolutionJillian Fluet’S Potw Solution
Jillian Fluet’S Potw Solution
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 

Profunctor and Arrow

  • 1. . ProFunctor and Arrow – profunctors hackage library – . Kei Hibino : http://twitter.com/khibino 2013-03-31 . . . . . .
  • 2. Functor Functor f = > f b Functor ( a - >) = > ( a - >) b --- 終域だけ - only co - domain fmap :: ( a -> b ) -> f a -> f b --- 終域を変える - map co - domain . . . . . .
  • 3. Arrow Arrow a => a b c Arrow ( - >) = > ( - >) b c --- 始域と終域が両方ある --- both domain and co - domain (^ > >) :: Arrow a = > ( b -> c ) -> a c d -> a b d ^ ^ --- 始域を変える - map domain (^ < <) :: Arrow a = > ( c -> d ) -> a b c -> a b d ^ ^ --- 終域を変える - map co - domain . . . . . .
  • 4. ProFunctor ProFunctor p = > p a b --- 始域と終域が両方ある --- both domain and co - domain lmap :: ProFunctor p = > ( b -> c ) -> p c d -> p b d ^ ^ --- 始域を変える - map domain rmap :: ProFunctor p = > ( b -> c ) -> p a b -> p a c ^ ^ --- 終域を変える - map co - domain . . . . . .
  • 5. Strong type class in profunctors first ’ :: p a b -> p (a , c ) (b , c ) second ’ :: p a b -> p (c , a ) (c , b ) Arrow ( first , second ) . . . . . .
  • 6. Choice type class in profunctors left ’ :: p a b -> p ( Either a c ) ( Either b c ) right ’ :: p a b -> p ( Either c a ) ( Either c b ) ArrowChoice ( left , right ) . . . . . .
  • 7. Conclusion ProFunctor は Arrow の制約を分割して提供してい るイメージ . . . . . .