Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PureScript.tw Meetup 2: Tutorial 2

PureScript.tw Meetup 2: Tutorial 2

Range: Ch6 of the book PureScript by Example

Ray Shih

April 28, 2017
Tweet

More Decks by Ray Shih

Other Decks in Technology

Transcript

  1. Chapter 6: Type Classes • Similar to Java interface •

    Show • Monoid, Foldable -> foldMap • Functor • Function constraint • Multi Parameter Type Classes • Nullary Type Class • Superclass
  2. Challenge! • Try to create a function `printf` which can

    print out arbitrary number of arguments • printf “Hello” “World” • printf “a = “ 3 • printf a “ + “ b “ = “ (a + b)
  3. Chapter 7: Applicative Validation • Control.Apply, lift3 on Maybe •

    type class Apply • type class Applicative • Maybe -> Either: withError • combineList • purescript-validation (skip) • Traversable Functor • Parallelism
  4. Chapter 8: The Eff Monad • Do notation revisited •

    XML traverse • The Monad Type Class • Monad Law (skip) • Folding With Monads • Monads and Applicative • Eff Monad
  5. FoldM exercise • (Medium) Write a function sums which uses

    foldM to determine all possible totals that could be made using a set of coins. The coins will be specified as an array which contains the value of each coin. Your function should have the following result.
  6. Monads and Applicatives • Of course, Monad is a Applicative

    • But Monad is more than Applicative
  7. Next? • Frontend Pux? • Backend? • React Native? •

    Chapter 11: Monadic Adventures? • Lenses? • PureScript 24 days?