applicative functors in swift

Download Applicative Functors in Swift

Post on 16-Apr-2017

3.205 views

Category:

Engineering

0 download

Embed Size (px)

TRANSCRIPT

  • Applicative Functors in Swift

    @kazu0620

  • ( @kazu0620 ) Sansan Eight

    - (40DL!) - (15DL!)

  • Swift 2 Advent Calendar 2015

    Optional

    http://qiita.com/kazu0620/items/f2a6272c6b8b7bcbaa42

    http://qiita.com/kazu0620/items/f2a6272c6b8b7bcbaa42

  • @koher

  • curry(+) a b

    RunesCurry

  • curry

  • Runes

    curry(+) a b

  • Optional()

    ArrayOptional)

    ...?

  • reference: Functors, Applicatives, And Monads In Pictures()

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

    2(a)(nil)

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

  • reference: Functors, Applicatives, And Monads In Pictureshttp://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

    (unwrap)

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

  • map

    map

    map

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.htmlreference: Functors, Applicatives, And Monads In Pictures

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

  • Fanctor?

  • Fanctor

    Fanctor

    = Fanctor

    Fanctor(nil)

    map

    Fanctor

  • map

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.htmlreference: Functors, Applicatives, And Monads In Pictures

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

  • Applicative Functor?

  • Applicative Functor

    Fanctor

    SwiftRunes

  • Applicative Functor

    FanctormapApplicative Functor

  • Applicative Functor

    Optional()

  • Applicative Functor

  • Applicative FunctorflatMap+map

    &

  • Applicative Functor

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.htmlreference: Functors, Applicatives, And Monads In Pictures

    Applicative Functor

    http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

  • Optional

    sumThreeElementsOptionalx, y, z(Optional)

    curry

  • curryCurry

  • :x :y(z)sumTreeElements

  • (

    :

    : 1()

  • Curry

  • pure

    +

    pure.Some

    .Some

  • pure

    xyOptional

    pureArray

  • result1result2

    a.map(f)

  • 3

    (+)xy

  • curry(+) a b

    +

    Optional(.Some)

    Optionalabunrwap+

    Optional

  • OptionalUnwrapOptional

    OptionalUnwrap

  • Functor, Applicative, Monad

  • We're hiring!

    SansanSwift

    Kotlinandorid

    React.js

    ruby/C#

  • We're hiring!

    wantedly

    https://www.wantedly.com/companies/Sansan/projects

    http://jp.corp-sansan.com/recruit/job/index.html

    (@kazu0620OK)

    https://www.wantedly.com/companies/Sansan/projectshttp://jp.corp-sansan.com/recruit/job/index.html

Recommended

View more >