Introduction to algebraic javascript specification

Setoid
Ord
Semigroupoid
Category
Semigroup
Monoid
Functor
Contravariant
Apply
Applicative
Alt

Plus
Alternative
Foldable
Traversable
Chain
ChainRec
Monad
Extend
Comonad
Bifunctor
Profunctor

Goal: reading specification

  • Algebraic structures 
  • Type signatures
  • Functor
  • Applicative
  • Apply
  • Chain
  • Monad

Fantasy Land

map :: Functor f => f a~> (a -> b) -> f b

method name

type constraints

method on type f

type variables

arguments

return value

extended Hindley-Milner type system

Applicative

Apply

map :: Functor f => fa ~>  (a -> b) -> fb

   ap :: Apply f    => fa ~> f(a -> b) -> fb

Chain

  map :: Functor f => fa ~>  (a -> b) -> fb

     ap :: Apply f    => f(a -> b) ~> f a -> fb

chain :: Chain f    => fa ~>  (a -> fb) -> fb

Monad

Monads are things that contain computational context (values, in most cases), and have one operation to manipulate some values of the monad (chain), and an operation to put values into a monad (of).

https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript

http://www.tomharding.me/

Algebraic Javascript Specification

By Marius Jurgelenas

Algebraic Javascript Specification

Presentation for wix front-end guild

  • 374