SlideShare une entreprise Scribd logo
1  sur  7
Télécharger pour lire hors ligne
.
        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 の制約を分割して提供してい
  るイメージ




                        .   .   .   .   .   .

Contenu connexe

Tendances

Memory efficient pytorch
Memory efficient pytorchMemory efficient pytorch
Memory efficient pytorchHyungjoo Cho
 
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)Sylvain Hallé
 
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 AKSHAY SACHAN
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operatorsHarleen Sodhi
 
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 Sylvain Hallé
 
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...akaptur
 
Fp in scala with adts
Fp in scala with adtsFp in scala with adts
Fp in scala with adtsHang Zhao
 
Lecture 05 Association Rules Advanced Topics
Lecture 05 Association  Rules  Advanced  TopicsLecture 05 Association  Rules  Advanced  Topics
Lecture 05 Association Rules Advanced TopicsPier Luca Lanzi
 
Sequential pattern mining
Sequential pattern miningSequential pattern mining
Sequential pattern miningkiran said
 
4 Type conversion functions
4 Type conversion functions4 Type conversion functions
4 Type conversion functionsDocent Education
 
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...Johan Alexis Arboleda Echeverri
 
Advanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriterAdvanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriterWeaveworks
 
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 exploitationOWASP Hacker Thursday
 
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 VolumeVissarion Fisikopoulos
 
Jillians Potw
Jillians PotwJillians Potw
Jillians Potwsabsma
 
Jillian Fluet’S Potw Solution
Jillian Fluet’S Potw SolutionJillian Fluet’S Potw Solution
Jillian Fluet’S Potw Solutionjillianfluet
 

Tendances (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
 

Dernier

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 

Dernier (20)

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 

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 の制約を分割して提供してい るイメージ . . . . . .