4 Jun
2003
4 Jun
'03
12:46 p.m.
Now, obviously, the problem is that fst and snd, being passed in a list, needs to be of the same type; this complicates classifying a list of type [(Int,Bool)], for instance¹.
I have a similar problem. Say I have a record:
data Rec = Rec { a :: Int, b :: Type1, c :: Type2, d :: Type3, ... } rec = Rec { a = 1, b = ... }
Now I want to print part of the record. What I would like to do is the following
putStrLn $ concatMap show [a,c,d]
!!! bang !!! So what I actually do is
putStrLn $ concat [show a, show c, show d]
Works, but a little bit clumsy, especially with long lists. Is there a nice solution? Markus