I read this article.
This is a very simple example of a common pattern you will see throughout Haskell. Making basic functions that are obviously correct and then combining them into more complex functions. This way you also avoid repetition. What if some mathematicians figured out that 2 is actually 3 and you had to change your program? You could just redefine
doubleMe
to bex + x + x
and sincedoubleUs
callsdoubleMe
, it would automatically work in this strange new world where 2 is 3.
When I called doubleUs 3 4
it should return 21
because I redefined the doubleMe
function, but the function returned 14
.