SlideShare a Scribd company logo
Monad as "Things to Do"
Yuji Yamamoto
2015-05-24
Nice to meet you!
Yuji Yamamoto(@igrep) age 26.
Remember this avator:
Nice to meet you!
Yuji Yamamoto(@igrep) age 26.
Japanese Ruby engineer working at Sansan, Inc.
Hobby Haskeller.
Holding workshop of Haskell (Japanese) per month.
I'm gonna talk about...
Describe Monad in Haskell from a my point of view.
This↓
class Monad m where
return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b
-- snip. --
I don't know much about Monad in category theory.
Disclaimer: it'd sound too natural for people who already know
Monad.
In short,
I got fairy sure of Monad in Haskell by interpreting it as
"things to do every time a function returns a value."
Monad is a type class
Like this (reprinted) ↓
class Monad m where
return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b
-- snip. --
Recall what a type class is:
something like...
Interface in Java and C# etc.
Module providing mix-in in Ruby.
=> Provides a way to put types with same behavior
altogether!
Why type class is useful
When creating a type, get various functions available for the
type class
only by defining the required methods.
The only thing to do is to write all the computation unique to
the new type in the required (undefined) methods!
Then, how about Monad?
By defining only return and >>= method,
do notation available!
And more!
Write only computation unique to a new Monad (its instance)
in the required (and undefined) method!
Let's see >>= method!
(>>=) :: m a -> (a -> m b) -> m b
Like the other type classes, Monad abstracts types
by defining the unique computation in the required >>=
method.
Let's see >>= method!
(>>=) :: m a -> (a -> m b) -> m b
For example...
In Maybe, >>= checks Just a or Nothing
before passing a of m a to (a -> m b).
In Reader, >>= supplies the missing argument to the reader
function
before passing a of m a to (a -> m b).
In Parser, >>= consumes the given string
before passing a of m a to (a -> m b).
Let's see >>= method!
(>>=) :: m a -> (a -> m b) -> m b
In both types,
>>= has some required computation
to pass a of m a to (a -> m b).
In addition,
>>= is implemented so that
the required computation can be repeated by passing m b of
(a -> m b) to another function.
In other words,
Monad's >>= has all things to do
in the part of passing a of m a to (a -> m b)
Monad assigns >>= things to do
to pass a value (not wrapped by a Monad) to a (a -> m b)
function
each time the source (a -> m b) function returns a value.
That is!
Monad is useful
when you have many functions of type (a -> m b) with things
to do.
For example!!
For functions that force you to check if successful each time
executing.
=> Maybe Monad
For functions that force you to append the result log each
time executing.
=> Writer Monad
For functions that force you to make a side effect (e.g. I/O)
each time executing.
=> IO Monad
Then, what's the merit of this idea?
I've seen many metaphors describing Monads (in Japanese),
But all of them are too abstract to grasp.
Then, what's the merit of this idea?
By contrast, "things to do each time a function returns a
value" makes
it easier to imagine at least for us programmers (probably).
it possilbe to describe Monad based only on its property as a
type class.
them find Monad's merit more naturally.
Especially for those who are careful about DRYness
by telling "Monad packs things to do every time into one method".
it unnecessay to classify Monads into smaller kinds.
e.g. "failure monads", "stateful monads" etc.
Conclusion
Monad in Haskell is a type class.
Type classes abstract types with same behavior.
Monad abstracts "things to do each time a function returns a
value".
Thus, I've appended a new page of the history of the
numerous Monad tutorials...

More Related Content

Similar to Monad as things to do

The Road To Monad Transformers
The Road To Monad TransformersThe Road To Monad Transformers
The Road To Monad Transformers
Pawel Lisewski
 
Programming with effects - Graham Hutton
Programming with effects - Graham HuttonProgramming with effects - Graham Hutton
Programming with effects - Graham Hutton
Wen-Shih Chao
 
Machine learning @ Spotify - Madison Big Data Meetup
Machine learning @ Spotify - Madison Big Data MeetupMachine learning @ Spotify - Madison Big Data Meetup
Machine learning @ Spotify - Madison Big Data Meetup
Andy Sloane
 
Comonads in Haskell
Comonads in HaskellComonads in Haskell
Comonads in Haskell
David Overton
 
[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads
Functional Thursday
 
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
Philip Schwarz
 
Monads in Clojure
Monads in ClojureMonads in Clojure
Monads in Clojure
Leonardo Borges
 
Bound
BoundBound
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring Algorithms
Sri Prasanna
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
David Gu
 

Similar to Monad as things to do (10)

The Road To Monad Transformers
The Road To Monad TransformersThe Road To Monad Transformers
The Road To Monad Transformers
 
Programming with effects - Graham Hutton
Programming with effects - Graham HuttonProgramming with effects - Graham Hutton
Programming with effects - Graham Hutton
 
Machine learning @ Spotify - Madison Big Data Meetup
Machine learning @ Spotify - Madison Big Data MeetupMachine learning @ Spotify - Madison Big Data Meetup
Machine learning @ Spotify - Madison Big Data Meetup
 
Comonads in Haskell
Comonads in HaskellComonads in Haskell
Comonads in Haskell
 
[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads
 
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
 
Monads in Clojure
Monads in ClojureMonads in Clojure
Monads in Clojure
 
Bound
BoundBound
Bound
 
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring Algorithms
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
 

More from 悠滋 山本

Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】
Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】
Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】
悠滋 山本
 
Introduction to stack's docker integration (1)
Introduction to stack's docker integration (1)Introduction to stack's docker integration (1)
Introduction to stack's docker integration (1)
悠滋 山本
 
Whom to Recommend Elm to?
Whom to Recommend Elm to?Whom to Recommend Elm to?
Whom to Recommend Elm to?
悠滋 山本
 
いつもどおりのテンションでしゃべるEightの怪談
いつもどおりのテンションでしゃべるEightの怪談いつもどおりのテンションでしゃべるEightの怪談
いつもどおりのテンションでしゃべるEightの怪談
悠滋 山本
 
Predefを使ったsqlのトレース
Predefを使ったsqlのトレースPredefを使ったsqlのトレース
Predefを使ったsqlのトレース
悠滋 山本
 
Monadなんてどうってことなかった話 - Monadなんてただの型クラス!
Monadなんてどうってことなかった話 - Monadなんてただの型クラス!Monadなんてどうってことなかった話 - Monadなんてただの型クラス!
Monadなんてどうってことなかった話 - Monadなんてただの型クラス!
悠滋 山本
 
2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad
2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad
2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad
悠滋 山本
 

More from 悠滋 山本 (7)

Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】
Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】
Haskell-jpらしさって︖ 「⽬的」と「活動」のすべてを解説︕ 【プログラミング⾔語コミュニティーとしての Haskell-jp】
 
Introduction to stack's docker integration (1)
Introduction to stack's docker integration (1)Introduction to stack's docker integration (1)
Introduction to stack's docker integration (1)
 
Whom to Recommend Elm to?
Whom to Recommend Elm to?Whom to Recommend Elm to?
Whom to Recommend Elm to?
 
いつもどおりのテンションでしゃべるEightの怪談
いつもどおりのテンションでしゃべるEightの怪談いつもどおりのテンションでしゃべるEightの怪談
いつもどおりのテンションでしゃべるEightの怪談
 
Predefを使ったsqlのトレース
Predefを使ったsqlのトレースPredefを使ったsqlのトレース
Predefを使ったsqlのトレース
 
Monadなんてどうってことなかった話 - Monadなんてただの型クラス!
Monadなんてどうってことなかった話 - Monadなんてただの型クラス!Monadなんてどうってことなかった話 - Monadなんてただの型クラス!
Monadなんてどうってことなかった話 - Monadなんてただの型クラス!
 
2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad
2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad
2014 05-11-関数型lt大会-「やらなければならないこと」としてのhaskellのmonad
 

Recently uploaded

ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
ramrag33
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
gaafergoudaay7aga
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 

Recently uploaded (20)

ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 

Monad as things to do

  • 1. Monad as "Things to Do" Yuji Yamamoto 2015-05-24
  • 2. Nice to meet you! Yuji Yamamoto(@igrep) age 26. Remember this avator:
  • 3. Nice to meet you! Yuji Yamamoto(@igrep) age 26. Japanese Ruby engineer working at Sansan, Inc. Hobby Haskeller. Holding workshop of Haskell (Japanese) per month.
  • 4. I'm gonna talk about... Describe Monad in Haskell from a my point of view. This↓ class Monad m where return :: a -> m a (>>=) :: m a -> (a -> m b) -> m b -- snip. -- I don't know much about Monad in category theory. Disclaimer: it'd sound too natural for people who already know Monad.
  • 5. In short, I got fairy sure of Monad in Haskell by interpreting it as "things to do every time a function returns a value."
  • 6. Monad is a type class Like this (reprinted) ↓ class Monad m where return :: a -> m a (>>=) :: m a -> (a -> m b) -> m b -- snip. --
  • 7. Recall what a type class is: something like... Interface in Java and C# etc. Module providing mix-in in Ruby. => Provides a way to put types with same behavior altogether!
  • 8. Why type class is useful When creating a type, get various functions available for the type class only by defining the required methods. The only thing to do is to write all the computation unique to the new type in the required (undefined) methods!
  • 9. Then, how about Monad? By defining only return and >>= method, do notation available! And more! Write only computation unique to a new Monad (its instance) in the required (and undefined) method!
  • 10. Let's see >>= method! (>>=) :: m a -> (a -> m b) -> m b Like the other type classes, Monad abstracts types by defining the unique computation in the required >>= method.
  • 11. Let's see >>= method! (>>=) :: m a -> (a -> m b) -> m b For example... In Maybe, >>= checks Just a or Nothing before passing a of m a to (a -> m b). In Reader, >>= supplies the missing argument to the reader function before passing a of m a to (a -> m b). In Parser, >>= consumes the given string before passing a of m a to (a -> m b).
  • 12. Let's see >>= method! (>>=) :: m a -> (a -> m b) -> m b In both types, >>= has some required computation to pass a of m a to (a -> m b). In addition, >>= is implemented so that the required computation can be repeated by passing m b of (a -> m b) to another function.
  • 13. In other words, Monad's >>= has all things to do in the part of passing a of m a to (a -> m b) Monad assigns >>= things to do to pass a value (not wrapped by a Monad) to a (a -> m b) function each time the source (a -> m b) function returns a value.
  • 14. That is! Monad is useful when you have many functions of type (a -> m b) with things to do.
  • 15. For example!! For functions that force you to check if successful each time executing. => Maybe Monad For functions that force you to append the result log each time executing. => Writer Monad For functions that force you to make a side effect (e.g. I/O) each time executing. => IO Monad
  • 16. Then, what's the merit of this idea? I've seen many metaphors describing Monads (in Japanese), But all of them are too abstract to grasp.
  • 17. Then, what's the merit of this idea? By contrast, "things to do each time a function returns a value" makes it easier to imagine at least for us programmers (probably). it possilbe to describe Monad based only on its property as a type class. them find Monad's merit more naturally. Especially for those who are careful about DRYness by telling "Monad packs things to do every time into one method". it unnecessay to classify Monads into smaller kinds. e.g. "failure monads", "stateful monads" etc.
  • 18. Conclusion Monad in Haskell is a type class. Type classes abstract types with same behavior. Monad abstracts "things to do each time a function returns a value". Thus, I've appended a new page of the history of the numerous Monad tutorials...