DEV Community

Discussion on: Code Smell: No AND in Function name

Collapse
 
seanmclem profile image
Seanmclem

In the example of 2 functions, makeTea and addSugar, what would you name a function that eventually needs to call both functions?

Collapse
 
jbristow profile image
Jon Bristow • Edited

You have a new function...


addSugar :: Tea -> Tea
makeTea :: TeaLeaves -> Water -> Tea

makeSugaryTea :: TeaLeaves -> Water -> Tea
makeSugaryTea = addSugar . makeTea

-- pointfree equivalent of
makeSugaryTea t w = addSugar(makeTea t w)