On 11 Feb 2010, at 10:05, Vasyl Pasternak wrote:

> 
> But fromSql function could convert everything to String, so you never
> need to use `show`, just simply write
> 
> convrow2 :: [SqlValue] -> String
> convrow2 (x:xs) = foldl (\i j -> i ++ " | " ++ (fromSql j)) (fromSql x) xs

> But, IMO, this is more readable version of your function:
> 
> convrow2' :: [SqlValue] -> String
> convrow2' = unwords . intersperse "|" . map fromSql
> 

On 11 Feb 2010, at 10:06, Miguel Mitrofanov wrote:
> 
> What if you just omit the "show" function? fromSql seems to be able to 
> convert almost anything to String.


Ok, thanks, that's a big help. I'm really glad to get rid off all that extra 
cruft I had there. I'd forgotten about intersperse, too. The new code works 
fine.


Regards,
Iain
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to