3 ms·
Your snippet got cut off, care to paste the rest? I'm guessing it works by popping the format string and the first operand off the args, and then finding the f
by philsnow 14y ago
Your snippet got cut off, care to paste the rest? I'm guessing it works by popping the format string and the first operand off the args, and then finding the first formatting escape in the format string and formatting it, then recurse.
- chongli 14y agoYeah, sorry. Here's the full snippet: instance (PrintfArg a, PrintfType r) => PrintfType (a -> r) where spr fmts args = \ a -> spr fmts (toUPrintf a : args) And spr is a polymorphic function of the type: spr :: String -> [UPrintf] -> t Essentially the way this works is that it recursively conses up a list of the arguments, calling toUPrintf on each.