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

Kürzlich hochgeladen (20)

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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 

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