-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Template Haskell to generate the code for generic showb/showt/showtl #33
Comments
Having taken a quick look at this, I'm not convinced that a Template Haskell-based solution would necessarily be much cleaner. It might even present its own unique set of maintenance challenges. As an alternative, I'm wondering if it would be better to define a class like like: class (IsString a, Monoid a) => TextLike a where
showSpace :: a
showParen :: Bool -> a -> a
fromChar :: Char -> a And then make all of the operations in |
I pushed a proof-of-concept implementation of the ideas in #33 (comment) to the
And here are the same benchmarks on the
I'll keep the |
By a series unusual circumstances, I generate all of the code used for generically implementing
showbPrec
,showtPrec
, andshowtlPrec
... using CPP. And it's seriously ugly.We should replace this with Template Haskell quotes, which will (1) make this look more like actual Haskell code, and (2) make it much more maintainable in the future.
The text was updated successfully, but these errors were encountered: