Don’t fear the Monad

Math 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

Advertisements

About tomcircle

Math amateur
This entry was posted in math. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s