Monad
- Functional XSLT/XPath/XQuery - #5 Monad pattern
15 June 2024
Functional XSLT/XPath/XQuery - #5 Monad pattern
The monad is probably the most written about functional pattern, it is famous for convoluted and obtuse explanations, but I will steal some of the better explanations and translate them into XSLT/XPath.
(adapted directly from All About Monads - HaskellWiki).
“Suppose that we are writing a program to keep track of sheep cloning experiments. We would certainly want to know the genetic history of all of our sheep, so we would need
motherandfatherfunctions. But since these are cloned sheep, they may not always have both a mother and a father!