The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Adam Gashlin (3) [Avatar] Offline
I'm trying to understand the purpose of
toFormat ('%' :: chars) = Lit "%" (toFormat chars)
in listing 6.8. It looks like it will cause literals to be split whenever a % that is not %s or %d is encountered, which seems undesirable.

I thought it might be an implementation of an escape sequence so that it would be possible to print "%s" with printf "%%s", but that would look more like
toFormat ('%' :: '%' :: chars) = Lit "%" (toFormat chars)

Am I missing something?