[Haskell-beginners] Why ShowS?

Christopher Howard christopher.howard at frigidcode.com
Wed Aug 10 05:34:41 CEST 2011


Small point I'm confused about: Why is it that in the Numeric module, 
all the "show" functions return a "ShowS" type (String -> String) 
instead of just the String? The ShowS type is described as so...

"The shows functions return a function that prepends the output String 
to an existing String. This allows constant-time concatenation of 
results using function composition."

What is meant here by "constant-time concatenation of results using 
function composition"? Perhaps someone could provide an example?

-- 
frigidcode.com
theologia.indicium.us



More information about the Beginners mailing list