Don’t fear the Monad

ChefCouscous's avatarMath Online Tom Circle

Brian Beckman:

You can understand Monad without too much Category Theory.

Functional Programming = using functions to compose from small functions to very complex software (eg. Nuclear system, driverless car software…).

Advantages of Functional Programming:

  • Strong Types Safety: detect bugs at compile time.
  • Data Protection thru Immutability: Share data safely in Concurrent / Parallel processing.
  • Software ‘Componentisation’ ie Modularity: Each function always returns the same result, ease of software reliability testing.

Each “small” function is a Monoid.
f : a -> a (from input of type ‘a‘ , returns type ‘a’)
g: a -> a

compose h from f & g : (strong TYPING !!)
h = f。g : a -> a

[Note]: Object in Category, usually called Type in Haskell, eg.’a’ = Integer)

You already know a Monoid (or Category in general) : eg Clock

  1. Objects: 1 2 3 …12 (hours)
  2. Arrow

View original post 185 more words

Unknown's avatar

Author: tomcircle

Math amateur

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.