Giter Club home page Giter Club logo

workshop-fp-fundamentals's Introduction

Workshop FP Fundamentals

Topics

  1. Functions
    1. First class const getServerStuff = callback => ajaxCall(json => callback(json)); copied from Mostly Adequate Guide
    2. Pure functions (referential transparency)

      A pure function is a function that, given the same input, will always return the same output and does not have any observable side effect. Subtle example of an impure function:

      let minimum = 21;
      const checkAge = age => age >= minimum;
    3. Side effects (not bad, but should be contained) Impure functions can be made pure by wrapping them in a function (thunk): () => Math.random() "Dependency injection"
    4. Partial application and currying (also mention closures?) Partial application allows "configuration" Currying helps to compose n-ary functions and may force different order of arguments
    5. Compose and pipe
    6. Total/partial functions (nice bridge to Maybe/Option and Either/Result)
    7. Point-free style (tacit programming) Subjective
    8. Hindley-Milner type signatures
  2. Declarative vs imperative? Expressive code (see chapter 8.1 in FP for sceptics)
    1. In declarative code there's fewer variables, often only at the edges of the program; data and behavior are separated
  3. Explain:
    1. map() (also map2()?)
    2. of() (a.k.a. return())
    3. flatMap() (a.k.a. chain()(?) or bind())
    4. apply() (Promise.all() is maybe a tiny bit similar?): apply a (curried) function wrapped in a monad to arguments wrapped in a monad See: https://youtu.be/d2yLsBn_Lz0?si=VBXWuNY3V0sj_5m8&t=2544 and https://ramdajs.com/docs/#ap
    5. reduce() (a.k.a. fold())?
    6. traverse()?
    7. Functor: map(), Applicative: of() and apply(), Monad: of() and flatMap()
  4. Algebraic Structures (implemented by Type classes), probably also tell about types of polymorphism?
    1. Ord, Eq
    2. Functor
    3. Array
    4. Maybe/Option
    5. Either/Result
    6. IO
    7. Task
    8. Monad
    9. Applicative
  5. Algebraic Data Types
    1. Sum types
    2. Product types

Changes to slides

  • Replace "declarative" with "expressive". And mention some advantages of FP aren't exclusive to FP.
  • <blockquote cite="https://www.thebehavioralscientist.com/glossary/familiarity-bias#:~:text=unfamiliar%20options%20may%20be%20perceived%20as%20more%20difficult%20to%20process%2C%20which%20can%20make%20them%20less%20appealing" class="font-serif italic">
      …unfamiliar options may be perceived as more difficult to process, which can make them less appealing.
    </blockquote>
  • Stratified Design
  • Onion Architecture

Todo:

workshop-fp-fundamentals's People

Contributors

flauwekeul avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.