SlideShare una empresa de Scribd logo
1 de 7
Descargar para leer sin conexión
.
        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 の制約を分割して提供してい
  るイメージ




                        .   .   .   .   .   .

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
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
 

Último (20)

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, ...
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

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