
23 Jul
2014
23 Jul
'14
8:20 a.m.
Hi, I wrote this kind of code: data DataLog a = SingleData a | MultipleData [a] instance (Show a) => Show (DataLog a) where show (SingleData v) = show v show (MultipleData vs) = join "|" vs where join _ [] = [] join _ (x:[]) = show x join s (x:xs) = show x ++ s ++ join s xs It works but when the DataLog is String typed I got this result: "My Test"|"Another Value" I'd prefer have: My Test|Another Value I know the quote problem comes from the show function on String value. How could I do a show for no-string values and return directly the value for strings? Thanks. Chris