SlideShare uma empresa Scribd logo
1 de 28
State

    2009   5   31   id:hiratara
•
•   State
•               URI   Comparable
    Interface
      Comparable
         URI
(1)
Bool        length
      Float         fst
     Integer       take
     MyType         zip
   (Int, Bool)    myfunc
     [Char]         id
  Maybe String       ...
Int → Int → Int
         ...
Bool        length
      Float         fst
     Integer       take
     MyType         zip
   (Int, Bool)    myfunc
     [Char]         id
  Maybe String       ...
Int → Int → Int
         ...
Bool        length
      Float         fst
     Integer       take
     MyType         zip
   (Int, Bool)    myfunc
     [Char]         id
  Maybe String       ...
Int → Int → Int
         ...
id

      f -> f quot;abcquot;   [Char]
 id                                   head

[Char] -> [Char]                         Char   id
                             length
            take
                        Int      id
id

      f -> f quot;abcquot;   [Char]
 id                                   head

[Char] → [Char]                          Char   id
                             length
            take
                        Int      id
(2)
:


                Maybe

[Char]                          Maybe [Char]

                        Maybe

       length                          liftM length

                Maybe

     Int                         Maybe Int
[]

[Char]                 [ [Char] ]

                  []

    length                    liftM length

             []

 Int                     [ Int ]
[]                           [Char]


              []

[Char]                  [ [Char] ]

                   []

     length                    liftM length

              []

 Int                      [ Int ]
liftM                     Maybe


                     []

        [Char]                    [ [Char] ]

                           []

            length                       liftM length

                     []

         Int                        [ Int ]
(3) return
:
           Maybe


           return
[Char]              Maybe [Char]




           return
 Int                 Maybe Int
[]



         return
[Char]            [ [Char] ]




         return
 Int                [ Int ]
return
            State



            return
 [Char]                         State [Char]
            return
  Bool                           State Bool
            return
MyType                         State MyType

            return
IO String                     State (IO String)
(4) (>>=)
Maybe




[Char]                  Maybe [Char]


                 func



 Int                     Maybe Int
         Maybe
(>>=)
              Maybe




   [Char]                       Maybe [Char]
                        (>>=)



                      func             (=<<) func



        Int                      Maybe Int
              Maybe
State



                 (>>=)
[Char]                   State [Char]
          func1
                                 (=<<) func1
                 (>>=)
 Int                       State Int
          func2
                                 (=<<) func2

MyType                   State MyType
return

                  IO




   [Char]                  IO [Char]



         length

                  return
     Int                    IO Int
IO




[Char]                   IO [Char]

            return . length
   length

            return
 Int                          IO Int
(>>=)                         liftM

                 IO




  [Char]              (>>=)   IO [Char]

                 return . length
        length                     (=<<) $ return . length


                 return
    Int                            IO Int
•

• return

• (>>=)
•


•

•   State
• Haskell          Kleisli triple
                   Monad

• Kleisli triple        Monad



• Kleisli triple         liftM
                           (            Monad
                                    )

Mais conteúdo relacionado

Mais procurados (11)

05 c++-strings
05 c++-strings05 c++-strings
05 c++-strings
 
Strings
StringsStrings
Strings
 
Strinng Classes in c++
Strinng Classes in c++Strinng Classes in c++
Strinng Classes in c++
 
String Handling in c++
String Handling in c++String Handling in c++
String Handling in c++
 
Strings IN C
Strings IN CStrings IN C
Strings IN C
 
14 strings
14 strings14 strings
14 strings
 
Templating with your {{mustache}}js
Templating with your {{mustache}}jsTemplating with your {{mustache}}js
Templating with your {{mustache}}js
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
Fundamental JS
Fundamental JSFundamental JS
Fundamental JS
 
13 Strings and text processing
13 Strings and text processing13 Strings and text processing
13 Strings and text processing
 
Strings
StringsStrings
Strings
 

Mais de Masahiro Honma

Mais de 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
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
 
Arrows in perl
Arrows in perlArrows in perl
Arrows in perl
 
Hachioji.pm in Machida の LT
Hachioji.pm in Machida の LTHachioji.pm in Machida の LT
Hachioji.pm in Machida の LT
 
Monads in perl
Monads in perlMonads in perl
Monads in perl
 
ウヰスキーと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
 
Math::Category
Math::CategoryMath::Category
Math::Category
 

Último

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
 

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
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
 
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
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
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
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
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
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
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, ...
 
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...
 
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...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

Stateモナドの解説 前編

  • 1. State 2009 5 31 id:hiratara
  • 2. • • State
  • 3. URI Comparable Interface Comparable URI
  • 4. (1)
  • 5. Bool length Float fst Integer take MyType zip (Int, Bool) myfunc [Char] id Maybe String ... Int → Int → Int ...
  • 6. Bool length Float fst Integer take MyType zip (Int, Bool) myfunc [Char] id Maybe String ... Int → Int → Int ...
  • 7. Bool length Float fst Integer take MyType zip (Int, Bool) myfunc [Char] id Maybe String ... Int → Int → Int ...
  • 8. id f -> f quot;abcquot; [Char] id head [Char] -> [Char] Char id length take Int id
  • 9. id f -> f quot;abcquot; [Char] id head [Char] → [Char] Char id length take Int id
  • 10. (2)
  • 11. : Maybe [Char] Maybe [Char] Maybe length liftM length Maybe Int Maybe Int
  • 12. [] [Char] [ [Char] ] [] length liftM length [] Int [ Int ]
  • 13. [] [Char] [] [Char] [ [Char] ] [] length liftM length [] Int [ Int ]
  • 14. liftM Maybe [] [Char] [ [Char] ] [] length liftM length [] Int [ Int ]
  • 16. : Maybe return [Char] Maybe [Char] return Int Maybe Int
  • 17. [] return [Char] [ [Char] ] return Int [ Int ]
  • 18. return State return [Char] State [Char] return Bool State Bool return MyType State MyType return IO String State (IO String)
  • 20. Maybe [Char] Maybe [Char] func Int Maybe Int Maybe
  • 21. (>>=) Maybe [Char] Maybe [Char] (>>=) func (=<<) func Int Maybe Int Maybe
  • 22. State (>>=) [Char] State [Char] func1 (=<<) func1 (>>=) Int State Int func2 (=<<) func2 MyType State MyType
  • 23. return IO [Char] IO [Char] length return Int IO Int
  • 24. IO [Char] IO [Char] return . length length return Int IO Int
  • 25. (>>=) liftM IO [Char] (>>=) IO [Char] return . length length (=<<) $ return . length return Int IO Int
  • 27. • • • State
  • 28. • Haskell Kleisli triple Monad • Kleisli triple Monad • Kleisli triple liftM ( Monad )

Notas do Editor