Re: [Haskell-cafe] Reducing code for efficient ShowS

Why not use the dlist library:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dlist
With something like (untested code):
xs +++ ys = shows xs `append` shows ys x .++ ys = showChar x `cons` shows ys xs ++. y = shows xs `snoc` showChar y
ext3' = toList $ '(' .++ n +++ ' ' .++ s ++. ')'
I think you're missing the fromList parts among other things. That's an interesting idea. It appears to use the same idea as ShowS, but more generally with lists and not just strings. I think there's an added benefit to not having to remember the the type of the value being appended. It's one of the more convenient things about many dynamically typed languages. So, I would still vote for the class-based method, so that I can use (.+.) for both Char and everything else. Sean
participants (1)
-
Sean Leather