[Haskell-beginners] The Holy Trinity of Functional Programming

Costello, Roger L. costello at mitre.org
Wed Aug 22 13:38:01 CEST 2012

Hello Christopher,

> But do you think you could provide a
> more "real world" example of an application 
> of the "Holy Trinity" ideas?

A commonly cited real-world example that illustrates the first key idea (recursive data type) is a binary tree:

data Tree = Node String Tree Tree | Leaf

The elements of this data type include:


        	Node "Root" Leaf Leaf

	Node "Root" 	(Node "Left" Leaf Leaf) 
			(Node "Right" Leaf Leaf)

	And so forth.

Common functions on this data type include insertions, deletions, traversal.

I am not sure if there is a use for the infinite value of this data type.


More information about the Beginners mailing list